how to open file chooser that can choose multiple

2019-07-21 11:46发布

问题:

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

回答1:

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



回答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:

  • Upload multiple files
  • jQuery multiple upload plugin
  • Ajax file upload (the best one in my opinion)


回答3:

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