so i have searched many questions posted and i cant find the right answer to my problem. Basically, i have an input type file which is multiple, what I want to do is display all the files selected and then for each item there is remove button something like this:
Now here's my problem,
How do I update the value of the input type file, when I removed an item in the selected items? and also how will the formdata read the value of the input?
$('.view').on('change', '#form-add-note #file', function(event){
var files = event.originalEvent.target.files;
files.forEach(function (file) {
// do something
});
});
$('.view').on('click', '#file-attachment-remove', function(e){
var filename = $(this).data('name');
// will act as remove item and updates the input value
});
<div class="row">
<div class="col-100">
<label class="file-label button button-big color-black f16 bold link" for="file"><i class="fa fa-paperclip"></i><span class="file-text">Add Attachments</span></label>
<input type="file" name="addnote-attachment[]" id="file" class="inputfile" multiple="true" />
</div>
and after that it needs to update the value of the input too so that the form data will know that i remove and item in the selection, because i use the name attribute for every input i
This question is the most similar but it doesnt solve my problem.. How to remove one specific selected file from input file control