views:

910

answers:

3

I have been using "input type='file' " tag to upload single file but I want to extend the functionality to upload multiple files (selecting multiple file in the same dialog box to upload). I don't have any idea how to accomplish these, any ideas and suggestions?

A: 

Please refer to this http://www.roseindia.net/jsp/file%5Fupload/uploadingMultipleFiles.shtml

MemoryLeak
I don't want to create seperate input tag for each file. Say I want to upload 10 files, i need to create 10 input tag. To eliminate these situations, I mention clearly "(selecting multiple files in same dialog box)" in my question.
Atul
http://swfupload.org/Then please try this.
MemoryLeak
I used that before, it is very conveninent
MemoryLeak
+2  A: 

You cannot use simple html to accomplish this. If you insist using just html, you have to make a lot of input type='file' tags.

However, javascript can help you with this, for example:

http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/

or google for it: http://www.google.com/search?client=safari&rls=en&q=multiple%20upload%20javascript&ie=UTF-8&oe=UTF-8

Winston Chen
This is good but there some javascript which helps me to select multiple files in the "File upload dialogbox" e.g. selecting multiple files using ctrl/shift etc.
Atul
I am sure you are able to find that easily. Google is a nice friend. Moreover, if you want some easy template for it, you can always go to some javascript libraries or frameworks, like jQuery, Mootool... etc.
Winston Chen
+4  A: 

(selecting multiple files in same dialog box)

Can't be done in HTML.

...unless you use an old version of Opera, which supported this. HTML file upload fields were actually supposed to support selecting and uploading multiple files in a single field, but most browsers never supported it, and many web applications would fail if you tried. So the feature is quietly ignored.

If you absolutely must have this feature (most users don't know it's even possible to ctrl-click multiple files in a finder, so some explanation will be necessary), you will have to use Flash. See eg. SWFUpload. Do provide HTML backup options for people without Flash or who hate using Flash uploaders because they seem to stiff up the browser so often (for example).

bobince
[note: since this was posted, HTML5 has introduced the `multiple` attribute to `<input type="file">`. Safari 4, Chrome 3 and Firefox 3.6 support it.]
bobince