0

I have a file input with multiple attribute

I want when user select multiple file in this control split those files and create multiple file input with each one having only one of those files selected.

This allow a user to select multiple files at once but delete them individually if he wants.

Beside i want to ajax upload those files one by one while allowing user to cancel any of those file being uploaded.

any idea.

Ahmad Rahimi
  • 31
  • 1
  • 4
  • I don't think you'd be able to populate a file upload like that - seems like a security risk. But why would you want to? Server-side code can handle multiple selections fine. – Adam Hopkinson Sep 15 '14 at 08:17

2 Answers2

1

You can use one of the free jQuery plugins available.

jQuery File Upload Demo

Uplodify

Scription
  • 646
  • 3
  • 12
  • 21
0

You cannot set the "files" or "value" attribute on a file input - therefore you can't just create new file inputs and fill them with one file each. But you can use the new HTML5 FormData object to upload each file separately. So you just display the original file input's "files" attribute as a list. The user can de-select the indices. When he submits you can iterate the files attribute and skip the de-selected indices. See https://stackoverflow.com/a/24089581/4809444

Community
  • 1
  • 1