tags:

views:

489

answers:

5

Gmail just released an update to their interface allowing the user to select more than one file for upload by using the CTRL-button. How do they do that? You can read about the new feature and see a screen shot here:

http://gmailblog.blogspot.com/2009/02/updates-to-attachments-multi-select-and.html

+3  A: 

Adobe Flash Player.

Here's a good library that I used: SWFUpload

Of course this is a JavaScript library, and not a jQuery plug-in, making it much more portable.

Luca Matteis
Thank you for the link. I will upvote you, but accept Stiropor's answer as he was the first with a link to a working library.
Espo
+7  A: 

You will need to find flash-based sollution, like Google did with Gmail. You can try this jQuery plugin that offers exactly that: jQuery File Upload Plugin

Stiropor
Thank you that works great!
Espo
A: 

Not the method Gmail uses, but the following link, combined with some jquery you can allow an unlimited number of files to be uploaded at the same time: Link

Marius
That will not allow me to use CTRL to select multiple files in the upload dialog.
Espo
A: 

Take a look at RFC 1867 It defines how to upload files over HTTP using the multipart/mixed encoding. You can use the Apache Commons FileUpload library to do this in Java. I don't know how Google does it, but you can manage the multiple selects with JavaScript processing in your page.

John Ellinwood
Are you sure Apache Commons FileUpload lets the user pick multiple files from a directory using the CTRL-button on his keyboard?Also, I am not sure that Javascript is enough if I want the user to select multiple files from the same dialog box.
Espo
A: 

Google isn't using Flash, but actually some clever javascript (well, that IS what they're all about it seems :-) ). Using javascript and css, you can create a file chooser that lets the user select the file to upload. Then, you use a hidden iframe. The act of posting the form with your upload file targets the hidden iframe so that the result returned from the server on success goes into that hidden iframe. Using javascript, monitor the document body of that iframe to know when the file is uploaded.

This link appears to be a quick example of the basic concept: http://www.seemysites.net/projFolder/uploader/

Jarret Hardie
Please read my question again, and you will understand that your answer is not correct. They are using flash, it seems, to allow the user to use CTRL to select multiple files.
Espo
Downvoted for not reading the question.
epochwolf
Thanks for pointing that out... silly me and my preconceived notions.
Jarret Hardie