views:

467

answers:

1

We have a web site where a user can upload their resume. If they upload it in any browser it works fine. If they do NOT upload a document it works fine in all browsers but google chrome. We have a server side vb dll that captures the form contents and any files uploaded are stored in a dictionary object which the processing page then queries. In chrome our dll is reporting that there one file is uploaded when you don't actually upload anything. Again, other browsers don't do this so I'm not sure what's going on. Has anyone seen behavior like this and if so, is there a fix? Thanks.

+1  A: 

I had the same problem in my ASP project, where the HTTP header is handled by a VB function like this. I wrote this simple form and I analyzed the HTTP header sent to the web server:

<form method="post" enctype="multipart/form-data" action="">
    <p><input type="file" name="file1" id="file1" /></p>
    <p><input type="submit" name="send" id="send" value="Send" /></p>
</form>

If the input file is empty and the user click "Send", all browsers (except Chrome) sends this HTTP header:

-----------------------------11538186919912
Content-Disposition: form-data; name="file1"; filename=""
Content-Type: application/octet-stream


-----------------------------11538186919912
Content-Disposition: form-data; name="send"

Send
-----------------------------11538186919912--

Google Chrome, instead, sends this HTTP header:

------WebKitFormBoundaryD4c5HZchlBudkIaQ
Content-Disposition: form-data; name="file1"; filename=""


------WebKitFormBoundaryD4c5HZchlBudkIaQ
Content-Disposition: form-data; name="send"

Send
------WebKitFormBoundaryD4c5HZchlBudkIaQ--

Google Chrome, if the input file is empty, don't sends the "Content-Type" field. This is the only difference. Probably, as in my project, this difference can cause errors in your DLL.

I hope I have helped you, sorry for my bad English!

Fabio

related questions