3

I'd like to have an <input type="file"> form element that fires the upload process immediately after the user chooses a file, without the need to the user to take the second additional step of clicking "upload".

How can I start the file upload process immediately upon selecting a file and actually execute the file transfer asynchronously?

EDIT: Uploadify looks good -- except that it requires Flash to upload. I'd like to try to avoid that if possible. Requiring Flash to upload files could prove to be a roadblock to people just trying to get photos online. My target website audience is people who don't have a lot of experience with internet, forms, etc. I'm trying to make the process as simple as possible.

2 Answers 2

4

You do not need any libraries. Create a hidden iframe (visibility: hidden not display:none) with an id. Then set the target property on the upload form to this iframe. Trigger the form submit as usual.

Sign up to request clarification or add additional context in comments.

2 Comments

I believe you can bind to the form upload input. Because of security restriction you may not be able to read its contents but just know it got triggered. This is totally possible to do as gmail email attachments work in a similiar fashion.
This seems like the way to go. Uploadify is Flash based, so I think that's out. I can set an "onchange" event on the file form element to trigger the form submit, thereby posting the file to the IFRAME. Thanks. It's a little hackish, but since you can't natively post form data via jQuery, this workaround seems like the best bet.
2

Use Uploadify >> http://www.uploadify.com/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.