162
rated 0 times
[
164]
[
2]
/ answers: 1 / hits: 60428
/ 10 Years ago, thu, may 1, 2014, 12:00:00
<input type='file' name=image onchange=preview(this); multiple=multiple />
window.preview = function (input){
if(input.files && input.files[0]) {
var reader = new FileReader();
reader.readAsDataURL(input.files[0]);
reader.onload = function(e){
$(#previewImg).append(<img src=' + e.target.result +'>);
}
}
}
I have a function using file reader to preview image, It works fine in single file.
However I try to achieve multiple files.
My question is how to get input files array, loop files through file reader and append img
More From » jquery