Problem uploading files - name does not allow blank

Last post 07-07-2010, 4:47 AM by SchelloehB. 4 replies.
Sort Posts: Previous Next
  •  06-28-2010, 4:36 AM 62037

    Problem uploading files - name does not allow blank

    I have a problem uploading files - the standard Windows filename allows blanks, but the user is presented with an error message, when trying to upload such a file:
     
    "File name not allowed. Please keep the filename one word with no spaces or special characters".
     
    I am using the standard setting in the three config files:

    <security name="filenamePattern">

    ^[a-zA-Z0-9\._\s-]+$

    </security>
     
    I tested the expression in several regular expression testers and found it to accept blanks in the filename. I even could make it much easier with the same positive result with
    ^[\w\._\s-]+$
     
    As far as I have seen in the testers and in the definition, the \s should allow whitespace characters, but it doesn't when uploading? What else has to be prepared on IIS side or elsewhere? We refreshed the pool already.
     
    Additionally, there seems to be a problem with file extensions. I had a very long list for file extensions when uploading files

    <security name="DocumentFilters">

    <item>avi</item>

    <item>bat</item>

    <item>bmp</item>

    <item>cf</item>

    <item>chm</item>

    <item>class</item>

    <item>cmd</item>

    <item>csv</item>

    <item>ctl</item>

    <item>dat</item>

    <item>dll</item>

    <item>dis</item>

    <item>doc</item>

    <item>docx</item>

    <item>dux</item>

    <item>edi</item>

    <item>evt</item>

    <item>exe</item>

    <item>fmb</item>

    <item>gif</item>

    <item>htm</item>

    <item>html</item>

    <item>ica</item>

    <item>ics</item>

    <item>ini</item>

    <item>jar</item>

    <item>jpeg</item>

    <item>jpg</item>

    <item>lcf</item>

    <item>log</item>

    <item>lst</item>

    <item>mdb</item>

    <item>mpp</item>

    <item>msg</item>

    <item>out</item>

    <item>pdf</item>

    <item>pkb</item>

    <item>pkg</item>

    <item>pks</item>

    <item>plb</item>

    <item>plh</item>

    <item>pll</item>

    <item>pls</item>

    <item>png</item>

    <item>ppt</item>

    <item>pptx</item>

    <item>prc</item>

    <item>properties</item>

    <item>ps</item>

    <item>rar</item>

    <item>rdf</item>

    <item>reg</item>

    <item>rtf</item>

    <item>sql</item>

    <item>tab</item>

    <item>tif</item>

    <item>trc</item>

    <item>tsv</item>

    <item>txt</item>

    <item>upx</item>

    <item>vsd</item>

    <item>vsdx</item>

    <item>wft</item>

    <item>wfv</item>

    <item>wwb</item>

    <item>xla</item>

    <item>xls</item>

    <item>xlsx</item>

    <item>xml</item>

    <item>zip</item>

    </security>

    But it did not show all available files in the directory of the user (e.g. no .xls, even they are in the list). I made this list shorter - and now it works for the basic file types.
     
    Can I get it to work for more file types? Is there any restriction in the number of items?
     
    Is there a difference between "normal" users and "admins" - if the .config files look the same? And how can I get it the same?
  •  06-29-2010, 2:28 AM 62059 in reply to 62037

    Re: Problem uploading files - name does not allow blank

    Hi SchelloehB,
     
    1. Can I get it to work for more file types? Is there any restriction in the number of items?
     
    Is not any restriction of the items.
     
    2. Is there a difference between "normal" users and "admins" - if the .config files look the same? And how can I get it the same?
     
    Just let you can make for different users in different settings.
     
    You can set it by property 'SecurityPolicyFile', like below
     
    SecurityPolicyFile="Admin.config"
     
    Regards,
     
    ken
  •  07-02-2010, 2:05 AM 62214 in reply to 62059

    Re: Problem uploading files - name does not allow blank

    Ok, it is set to default.config - and this config contains

    <security name="filenamePattern">^[a-zA-Z0-9\._\s-\#]+$</security>

    It does not allow blanks! The expression testers do.
     
    If I keep the list of file endings short, it allows all the listed entries - if I make it longer, it does not!
    E.g. I have set now

    <security name="DocumentFilters">

    <item>bmp</item>

    <item>csv</item>

    <item>dat</item>

    <item>doc</item>

    <item>docx</item>

    <item>gif</item>

    <item>htm</item>

    <item>html</item>

    <item>ica</item>

    <item>ics</item>

    <item>jpeg</item>

    <item>jpg</item>

    <item>lst</item>

    <item>mpp</item>

    <item>pdf</item>

    <item>png</item>

    <item>ppt</item>

    <item>pptx</item>

    <item>rar</item>

    <item>rtf</item>

    <item>tif</item>

    <item>txt</item>

    <item>vsd</item>

    <item>vsdx</item>

    <item>xla</item>

    <item>xls</item>

    <item>xlsx</item>

    <item>xml</item>

    <item>zip</item>

    </security>

    which is showing xls files.
     
    When using

    <security name="DocumentFilters">

    <item>avi</item>

    <item>bat</item>

    <item>bmp</item>

    <item>cf</item>

    <item>chm</item>

    <item>class</item>

    <item>cmd</item>

    <item>csv</item>

    <item>ctl</item>

    <item>dat</item>

    <item>dll</item>

    <item>dis</item>

    <item>doc</item>

    <item>docx</item>

    <item>dux</item>

    <item>edi</item>

    <item>evt</item>

    <item>exe</item>

    <item>fmb</item>

    <item>gif</item>

    <item>htm</item>

    <item>html</item>

    <item>ica</item>

    <item>ics</item>

    <item>ini</item>

    <item>jar</item>

    <item>jpeg</item>

    <item>jpg</item>

    <item>lcf</item>

    <item>log</item>

    <item>lst</item>

    <item>mdb</item>

    <item>mpp</item>

    <item>msg</item>

    <item>out</item>

    <item>pdf</item>

    <item>pkb</item>

    <item>pkg</item>

    <item>pks</item>

    <item>plb</item>

    <item>plh</item>

    <item>pll</item>

    <item>pls</item>

    <item>png</item>

    <item>ppt</item>

    <item>pptx</item>

    <item>prc</item>

    <item>properties</item>

    <item>ps</item>

    <item>rar</item>

    <item>rdf</item>

    <item>reg</item>

    <item>rtf</item>

    <item>sql</item>

    <item>tab</item>

    <item>tif</item>

    <item>trc</item>

    <item>tsv</item>

    <item>txt</item>

    <item>upx</item>

    <item>vsd</item>

    <item>vsdx</item>

    <item>wft</item>

    <item>wfv</item>

    <item>wwb</item>

    <item>xla</item>

    <item>xls</item>

    <item>xlsx</item>

    <item>xml</item>

    <item>zip</item>

    </security>

    it is not showing them (and others).
  •  07-02-2010, 2:50 AM 62227 in reply to 62214

    Re: Problem uploading files - name does not allow blank

    Hi SchelloehB,
     
    I tested the code your provided, it works fine for me.
     
    Can you create a paga like below and send me the test page URL?
     
    Please send the imformation to Kenneth@CuteSoft.net
     

    <%@ Page Language="C#" %>

    <%@ Register Namespace="CuteEditor" Assembly="CuteEditor" TagPrefix="CE" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>

    <body>
        <form id="form1" runat="server">
            <div>
                <CE:Editor ID="editor1" runat="server" >
                </CE:Editor>
            </div>
        </form>
    </body>
    </html>

    Regards,
     
    Ken
  •  07-07-2010, 4:47 AM 62322 in reply to 62227

    Re: Problem uploading files - name does not allow blank

    I did that - and copied my configs from the problematic app to it. It was working - like magic. Files with blank allowed, all files displayed (I tried some from the end like zip, xls, ...).
     
    I then copied the default.config back to my own application (same date and time) and overwrote it. I recycled the pool - and now it is working there, too.
     
    Thanks for your support.
     
    I am not sure how to set something to solved here - so please feel free to do it.
     
    I do not know how to get email on replies - so I checked some days later.
View as RSS news feed in XML