1

I found a snippet of code that will allow uploading of images via drag and drop, then populate a preview image on the screen. I'd like to modify this to allow images as well as short video clips, but can't seem to figure it out. Any help would be appreciated.

var imageLoader = document.getElementById('filePhoto');
imageLoader.addEventListener('change', handleImage, false);

function handleImage(e) {
var reader = new FileReader();
reader.onload = function (event) {

    $('.uploader img').attr('src',event.target.result);
}
reader.readAsDataURL(e.target.files[0]);
}

You can see fiddle here: http://jsfiddle.net/ELcf6/4/

and the post in which I found it originally, here: drag drop images input file and preview before upload

fbords
  • 41
  • 6

0 Answers0