开发者

Using jQuery to upload a file without clicking "Upload"

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 upl开发者_JS百科oad 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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜