2

I have multiple file input. I select five files in it. Can i delete from this input 1 or 2 files and upload? fiddle

HTML:

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

part of JS:

function handleFileDelete() {
    $(".thumb").on("click", function(){
        $(this).detach();
    })
}

I can delete preview, but how to delete value in input?

WaNgeL
  • 198
  • 1
  • 12

1 Answers1

0

It appears that you cannot: Remove selected file(s) before upload with Javascript as FileList has no api call to remove an item.

However, there is an alternative suggestion here which may help you, it provides an implementation on how to "clear" the file list: https://stackoverflow.com/a/13351234/2469255

Hope this helps.

Community
  • 1
  • 1
Kyle Muir
  • 3,875
  • 2
  • 22
  • 27
  • Ok.. How about another solution - take value of multiple file input(3 images) and send it to 3 hidden file inputs(no multiple) one by one. Then clean multiple input. And do what i want with this hidden imputs - remove, copy.. etc. Question - how to take and write value of multiple file input one be one? – WaNgeL Oct 03 '13 at 05:51
  • [This](http://jsfiddle.net/A3KJE/) or [this](http://jsfiddle.net/A3KJE/1/) way i can get names of files. But i think in my case it's useless.. – WaNgeL Oct 03 '13 at 08:02
  • @WaNgeL I am inclined to agree, without the underlying binary object there's not much you can do with it. `.getAsBinary()` is also obsolete now and as far as I can tell there's no (API) way of getting at it. – Kyle Muir Oct 03 '13 at 18:15