General Question

haegenschlatt's avatar

Chrome keeps prompting twice for a file upload when it should only prompt once. What's wrong with my code?

Asked by haegenschlatt (122points) January 1st, 2011

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

Not_the_CIA's avatar

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.

ETpro's avatar

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.

haegenschlatt's avatar

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.

Vortico's avatar

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's avatar

Your label around the file input isn’t closed, just missing a slash.

<label for=“file”>Image:<label>
<label for=“file”>Image:</label>

A validator will help you track down stuff like this more quickly.

http://validator.w3.org/

I usually just use one in my browser

http://users.skynet.be/mgueury/mozilla/
https://chrome.google.com/extensions/detail/cgndfbhngibokieehnjhbjkkhbfmhojo

Good luck with the project!

Vortico's avatar

Wow, I didn’t catch that. Nice, @funkdaddy!

haegenschlatt's avatar

@funkdaddy Thank you so very much. This has been bugging me to no end.

ETpro's avatar

@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

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther