Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html input file action after file selected

I am in a predicament with input files. The project I am working on has added a jQuery extension that masks all input types and makes them more 'vibrant'. However it has also caused a lot of trouble in the updating of what is listed in these inputs. One such problem is the input with type file. It currently will not change what is being uploaded after the very first selection. So I am wondering if there is a command you can use to do something after the user has selected a file (pressed the Open) button.

like image 503
Craig Avatar asked Oct 22 '10 18:10

Craig


1 Answers

I'm not exactly positive on what you're asking for but: you can bind logic to the input's onchange event. This will run the code attached to it after the user has selected their file(s) and pressed the "Open" or "Cancel" buttons.

Here's an example using jQuery (since you've already stated you're using it):

$("#yourFileInput").change( function() {
  alert("Hey, you changed me!");
});
like image 200
t3hb4tman Avatar answered Sep 28 '22 23:09

t3hb4tman