Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I googled it and found out that i can listen the onchange event on input type="file". But this works only with input without the multiple attribute. Does anyone know how to listen "files selected" event and fire a function after user has selected the files?

share|improve this question

1 Answer 1

<input type="file" multiple name="files" />

and in jquery:

$("input[type='file']").on("change", function(){
   var files = $(this).prop("files");  // you'll get selected file(s)

   console.log(files);  // here will display files as objects with their properties. Check with Chrome console what properties are.
});

if files is undefined then the browser must support HTML5.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.