Remove a FileList item from a multiple “input:file”

后端 未结 5 1136
生来不讨喜
生来不讨喜 2020-12-01 16:06

I have this DOM:

var id = 0;

$(\'input:file#upload\')[0].files[ id ]

That get\'s the first file on the 0th index. File properties are list

5条回答
  •  孤城傲影
    2020-12-01 17:01

    I' am afraid that you cannot delete objects from FileList object directly. Just assign $('input:file#upload')[0].files to an Array and then remove items from that array using splice or method of your choice and then use that Array.

提交回复
热议问题