Chrome keeps prompting twice for a file upload when it should only prompt once. What's wrong with my code?
I’m building a web application that prompts the user for an image to upload. After selecting an image and clicking on the “submit” button Chrome will prompt for a file again. After hitting “cancel” everything will work normally.
This bug does not occur on Firefox and other browsers.
Are there certain conditions in code that could cause this? I can provide source code if it is necessary.
I am using the latest version of Chrome on Windows 7 64-bit, although I’ve tested this to occur on both 32— and 64-bit systems.
I’ve checked my code and it doesn’t look like there’s anything wrong with it. How can I fix this?
Observing members:
0
Composing members:
0
8 Answers
I can check it on a Mac with Chrome if it is public. And I can look over your source if you post it to something like Pastebin.
If you can post a link to it, please do. I would like to take a look at how it differs from the code for upload buttons which I know to work fine in Chrome as well as all other browsers. If you can’t post it publically, PM us on a sample as @Not_the_CIA suggests.
I can post it publicly, it’s just a simple personal project to teach myself PHP + MySQL.
http://pastebin.com/v51CqMtM
I can post more if you would like, however this is the most relevant section.
That code looks okay. There must be some Javascript causing the retrigger. This may happen if you’ve added a feature to auto-submit the form after a user selects a file.
@funkdaddy Thank you so very much. This has been bugging me to no end.
@funkdaddy Good catch. @haegenschlatt when what seems like perfectly good HTML won’t work right in one browser, the validator is generally the first place to head. Unclosed tags can definitely throw a wrench in the works. Each browser has its own error correction algorithms, and tries to second guess what the HTML author really meant when it hits invalid code. So when one browser guesses wrong, the result is squirrely behavior.
Answer this question 
This question is in the General Section. Responses must be helpful and on-topic.