Coder Perfect

How can I use the input type=”file”> to choose several files?


How can I use the input type=”file”> to choose several files?

Asked by Mask

Solution #1

New answer:

In HTML5 you can add the multiple attribute to select more than 1 file.

<input type="file" name="filefield" multiple="multiple">

Old answer:

Answered by ZippyV

Solution #2

HTML5 has an input type=”file” multiple name=”files[]” /> element (specification).

On the desktop, browser support is very excellent (albeit IE 9 and earlier aren’t supported), but it’s less so on mobile, presumably because it’s more difficult to implement appropriately depending on the platform and version.

Answered by sylbru

Solution #3

It should all look like this:

<form enctype='multipart/form-data' method='POST' action='submitFormTo.php'> 
    <input type='file' name='files[]' multiple />
    <button type='submit'>Submit</button>

u have the enctype=’multipart/form-data’ attribute in your tag, or you can’t read the files on the server side after submission!

Answered by mark.inman

Solution #4

This jQuery plugin (jQuery File Upload Demo) accomplishes this without the need of flash in the following manner:

<input type='file' name='files[]' multiple />

Answered by DigitalDaigor

Solution #5

HTML5 allows you to do so right now.

On the file input, you essentially use the multiple attribute.

<input type='file' multiple>

Answered by Costa Michailidis

Post is based on