I want to have a single button that when clicked opens a file dialogue, and then after the user selects the photo they want to upload and the dialogue closes. I want the photo to upload. I cant think of a way of doing this because in the form you cant use both the type = file and type = submit together. Would I need to use jquery to achieve this? Thanks.
I want to have a single button that when clicked opens a file dialogue,
Share
Yes, the idea is to use jQuery for the inital part of having a user pick a file to upload… and then some sort of other, server-side language (like PHP,) will actually do the heavy lifting (by actually uploading the file.)
Here’s a jQuery plugin that helps you do this:
http://blueimp.github.com/jQuery-File-Upload/
EDIT:
Yes, I believe with jQuery (or some other library… or plugin,) it would be possible to have an event listener (or something,) pick up when a user browses for a file to upload… and automatically starts to upload it once the file has been chosen. But, again, as was said earlier, it’s probably safer to take a two-step approach to file uploads for now.