How to change the FileReader object?

0 like 0 dislike
10 views
There is a script for uploading images. He removes the preview, but the files remain the same. How to change the contents of FileReader, so when you remove the preview image were removed it would be from the object?
Upload your images


$(document).ready(function() { if (window.File && window.FileList && window.FileReader) { $("#files").on("change", function(e) { var files = e.target.files filesLength = files.length; for (var i = 0; i < filesLength; i++) { var f = files[i]; var fileReader = new FileReader(); fileReader.onload = (function(e) { var file = e.target; $("" + "
image" + "
Remove image" + "").insertAfter("#files"); $(".remove").click(function(){ $(this).parent(".pip").remove(); }); }); fileReader.readAsDataURL(f); } }); } else { alert("Your browser doesn't support to File API") } });
by | 10 views

1 Answer

0 like 0 dislike
Object FileReader lets web applications asynchronously read the contents of files (or data buffers) stored on the user's computer, using File or Blob objects, with which you specify the file or data to read.
To readand not to modify or delete.

You probably want to delete some files from the FileList, but you can't do it, because the read-only access.

If you want to send only some of your files, you can collect the desired files to FormData and send ajax'ohms.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
33,698 users