function uploadImages(uploader,callback1,callback2){    uploader.onchange=function(){        callback1()        var reader=new FileReader()        var i=0        reader.onload=function(){            var image=new Image()            image.onload=callback2            image.src=this.result            if(++i < uploader.files.length) reader.readAsDataURL(uploader.files[i])        }        reader.readAsDataURL(uploader.files[i])    }}uploader is the <input> elementcallback1 is called when the user uploads something (to reset things before handling the images)callback2 is called once per image, when it loads.This function is being used here.I feel like there might be a simpler way to do this.
Handling multiple uploaded images in JavaScript
javascript;file;image