Robert Harvey
Robert Harvey

Reputation: 180788

Selecting Multiple Files for Upload in Web Page

I am building a file upload web page that has the capability to process multiple upload files. Ideally I would like to allow the user to select a folder and have the web page enumerate the files in the folder client-side, but I don't think that's possible without a browser plugin.

Alternatively, would it be possible to allow the user to select multiple files in the File/Open dialog using Shift-click and Ctrl-click, and enumerate those?

To be clear, I don't want the user to have to specify each file individually by repeatedly opening and closing a File/Open dialog.

I can't use Flash or any other type of binary plugin, but jQuery is OK. I need to support IE7+, Firefox and Safari.

Upvotes: 4

Views: 5487

Answers (4)

Nasser Hadjloo
Nasser Hadjloo

Reputation: 12610

I strongly recommend reading this article by Rick Strahl

short answer for HTML5

<form method="post" enctype="multipart/form-data">                
  <label>Upload Images:</label>
  <input type="file" multiple="multiple" name="File1" id="File1" accept="image/*" />
  <hr />  
  <input type="submit" id="btnUpload" value="Upload Images" />
</form>

Upvotes: 1

Nabab
Nabab

Reputation: 2644

You need either Flash or Java to be able to select several files for upload.
Check this out: http://www.uploadify.com/
There are tons of other solutions... But none is pure HTML.

Upvotes: 0

Nick
Nick

Reputation: 3337

May want to try www.pulpload.com . Depending on the browser it could be a nice way to upload multiple files

Upvotes: 0

bobince
bobince

Reputation: 536379

would it be possible to allow the user to select multiple files in the File/Open dialog using Shift-click and Ctrl-click, and enumerate those?

No.

Although actually, according to the HTML spec, file upload fields were originally supposed to allow it. Opera supported this in an older version, but it made many webapps that weren't expecting multiple files fall over, so they stopped it.

The only way to do it today is with a plugin, preferably a Flash uploader backed with multiple HTML single-file-upload controls as fallback.

Upvotes: 3

Related Questions