Parsing content-disposion header's filename in multipart/from-data
        Posted  
        
            by Artyom
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Artyom
        
        
        
        Published on 2010-05-29T09:13:13Z
        Indexed on 
            2010/05/29
            9:22 UTC
        
        
        Read the original article
        Hit count: 349
        
Hello According to RFC, in multipart/form-data content-disposition header filename field receives as parameter HTTP quoted string - string between quites where character '\' can escape any other ascii character.
Problem web browsers don't do it.
IE6 sends:
Content-Disposition: form-data; name="file"; filename="z:\tmp\test.txt"
Instead of expected
Content-Disposition: form-data; name="file"; filename="z:\\tmp\\test.txt"
Which should be parsed as z:tmptest.txt according to rules instead of z:\tmp\test.txt.
Firefox, Konqueror and Chrome don't escape " characters for example:
Content-Disposition: form-data; name="file"; filename=""test".txt"
Instead of expected
Content-Disposition: form-data; name="file"; filename="\"test\".txt"
So... how would you suggest to deal with this issue?
© Stack Overflow or respective owner