0

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.

vtortola
  • 34,709
  • 29
  • 161
  • 263

1 Answers1

2

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.

NickAldwin
  • 11,584
  • 12
  • 52
  • 67
  • 1
    Here's a similar question (though the OP mentions he wants to use jQuery) http://stackoverflow.com/questions/710852/gmail-like-file-upload-with-jquery – NickAldwin Dec 29 '10 at 19:39
  • arghh... I don't want to use flash. I think I will have to wait for HTML5 :D. Thanks. – vtortola Dec 29 '10 at 19:50
  • 1
    @bitbitbit Yeah, it's unfortunate. The best you can do for your users, though, is to make it as easy as possible (even if that means using flash -- just hide it!) :) – NickAldwin Dec 29 '10 at 19:54