Upload a file with javascript
How could I upload files with jav开发者_如何学JAVAascript 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.
精彩评论