4

I want to be able to open a file chooser dialog, from which I will be able to choose more than one file from the same dircetory. Similarly to the behavior that 'add attachment to gmail' provides. Only I don't need to upload the files immediately through Ajax. the files that I chosed can be uploaded later when pressing on the submit button of that dialog.

The technologies that are available for me are:
html, javascript,, JQuery (only if it's really needed) JSP, java

Thanks

Spiderman
  • 9,602
  • 13
  • 48
  • 56

4 Answers4

3

As simple as it gets - just add "multiple" to the input element...

<input type="file" id="files" name="files" multiple>
2

This is not possible with Internet Explorer. Firefox (and also chrome) implements a multi-file selector in HTML5.

You can checkout the following alternatives using JavaScript:

Daniel Peñalba
  • 30,507
  • 32
  • 137
  • 219
  • I tried the demonstartion in the blog of your first link. And I could only choose one file at a time in this filechooser, not more than that. – Spiderman Dec 12 '10 at 13:00
  • @Spiderman: Yes, you can select one file at a time. But try selecting a file, and then other. A list of files is created and you can submit them together. – Daniel Peñalba Dec 12 '10 at 13:10
  • Exaclty - my original question is how can I chose more than one file with one file-chooser dialog opening – Spiderman Dec 12 '10 at 13:12
  • This is not possible in internet explorer. My suggestion is use an alternative. – Daniel Peñalba Dec 12 '10 at 13:13
  • @Spiderman: see my edits, the last alternative (Ajax file upload) works great. I don't know if it fits your needs. – Daniel Peñalba Dec 12 '10 at 13:20
2

You have a few options that I can thinnk of:

  • html5 <input type="file" multiple="multiple" /> (lots of examples out there)
  • Flash (swfupload is a standard here)
  • Silverlight
  • Java
ScottE
  • 21,530
  • 18
  • 94
  • 131
0

From previous research (and a quick Google search now), it appears that you can't do that solely with HTML/Javascript with one input selection. However, there are lots of Flash uploaders that will let you do this. But, since Flash is not one of your technologies listed, I'm not sure if you want to go that route...

mikesir87
  • 1,785
  • 1
  • 20
  • 25
  • So how am I capable of doing it through Gmail without any Flash?? – Spiderman Dec 12 '10 at 12:44
  • @Spiderman GMail uses Flash. http://stackoverflow.com/questions/710852/gmail-like-file-upload-with-jquery – Pekka Dec 12 '10 at 13:09
  • OK read the link that you added with the previuos stackoverflow question - that was really surprising but I think that it answers my question. Thanks – Spiderman Dec 12 '10 at 13:16