1

Possible Duplicate:
Multiple file selection for an upload control

Is it possible for me to use a

<input name="userfile[]" type="file" title="Select Your Files" multiple=""/>

To have the users select more than 1 file at once.. But then Separate all the files into individual file inputs via javascript?

As an example, i click to choose files for my input, and select Image1.jpg, image2.jpg. and image3.jpg all while holding ctrl for the multi-selection.. Then once i click on a button, a function is triggered that'll split that input into multiple single file inputs for each file.

Community
  • 1
  • 1
Stone
  • 60
  • 1
  • 9
  • Nope, the top 2 links are not what i'm trying to do. Thank you for the quick response though! – Stone Jul 09 '11 at 17:04
  • 2
    You're not going to be able to do this, because browsers will not let you set the value of "file" input elements. – Pointy Jul 09 '11 at 17:07

1 Answers1

1

This is not possible for security reasons. As @Pointy stated (in a comment to the question) you can't do this because the browsers' security model will not let you manipulate the value of the field with JavaScript.

There are many solutions to this problem (e.g. SWFUpload) that allow you to use a flash control to allow the user to pick as many files as desired (they even let you filter on what filetypes (and/or sizes)) are permitted... yet they will auto-split the files into separate fields that can be uploaded as normal or asynchronously via AJAX.

scunliffe
  • 57,883
  • 24
  • 118
  • 156