I am having some problems to take image as blob using jQuery:
Here is my code:
var file = $("#imgGaleria3")[0].files;
if (file) {
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function(e) {
// browser completed reading file - display it
alert(e.target.result);
};
}
And all the time im getting the same error: uncaught TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'.
How can I solve? I try some methods to read the data from file object with FileReader but nothing solves my problem.
Thx for ur help guys
reader.readAsDataURL(file);after assigning thereader.onload. and$("#imgGaleria3")[0].filesis an array of files . you should use$("#imgGaleria3")[0].files[0]