views:

446

answers:

3
<input type="file">

helps to select one file at a time.

I need to enable the users of my java-application to select more than one file in one go.

The application needs the user to upload 50-100 files and it surely is not feasible to ask the user to upload those 50-100 files one by one. I tried searching on the net for some help regarding selecting multiple files but of no help. The users simply hate using applet. So, this option is ruled out.

+2  A: 

Basically you need to use Javascript for this to dynamically create as many file input elements as you need on the page.

There are multiple existing solutions for this problem either, ranging from those that are integrating on both the server and client ends to those that are client only. I would suggest looking into something like the YUI Uploader at the very least.

cletus
+2  A: 

If the browser can't select multiple files for upload, then 100 INPUT boxes is still going to be a lot of work for the user. Maybe better to give them the option to collect the files into an archive (e.g. a zip file), and have your server unpack them when received.

joeytwiddle
A: 

To create a true multi-file upload form you will have to use a Flash or Java applet. The alternative is to dynamically add multiple input fields to the form using JavaScript, but that still requires the user to individually select files. One way of doing that is to use the jQuery multifile plugin but it sounds like that will not meet your requirements based on the number of files that need to be uploaded.

I would also suggest you create some kind of ZIP-based upload and handle it with server-side extraction if you must stick to plain HTML features, but that still requires the user to perform an extra step so it might be met with some resistance.

In HTML 5 there is a "multiple" attribute that you can set on the input tag which should produce the behaviour you need.

Pavel