javascript - jQuery: Cannot upload file via input click -


an area of page allows users drag , drop files , have upload (for debugging, having console.log filename. trying add ability click on div bring file dialog window can upload file through there. reason, not work. using event.datatransfer.files incorrectly?

here jsfiddle code.

the important bits are:

droparea.addeventlistener('click', handleclick, false); function handleclick(event) {     $("#fileupload").trigger('click');     console.log(event.datatransfer.files[0]['name']); } 

i figured out. per comments, had bind on change event. following solved issue:

$("#fileupload").on('change',function(){     //console.log(this.files);     processfiles(this.files); }); 

this.files contains filelist of files


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -