简体   繁体   中英

Upload a file with javascript

How could I upload files with javascript in the same way that Gmail does? I want no components or jQuery plugins, I just want to understand the technique.

I've found lots of articles about how to add input elements dynamically, or create fancy "marquee" progress bars, or dialogs, and also about comercial components or jQuery plugins. I just want to accomplish the same than Gmail does.

Thanks in advance.

Gmail currently uses (hidden) Flash uploading (see http://ajaxian.com/archives/multi-file-upload-in-the-flickr-and-gmail-house )

So if you want to do it like Gmail, you might want to check out SWFUpload . It uses javascript with a small flash object that's hidden to facilitate the upload. Here's an example of a regular form with an invisible SWFUpload component .

Pure javascript upload is not possible; some server interaction is required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM