How to upload multiple files in jsp?

10,505

Solution 1

(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).

Solution 2

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

Share:
10,505
Atul
Author by

Atul

I am just another guy which got struck at some simple questions and uses google and stackoverflow.com to solve them :).

Updated on June 04, 2022

Comments

  • Atul
    Atul almost 2 years

    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?