views:

30

answers:

3

I have a form that lets users upload a image of them self. I need an jQuery event handler for when the input in uploaded. As always muchas gracias to any help.

<script>
  $('#imageFile').someeventhander(function(){do some work son!});
</script>

<input id="imageFile" type="file">
+1  A: 

This is a very complex problem, as file inputs do not upload until you submit a form. See this related question:

http://stackoverflow.com/questions/166221

Ian Henry
Well i think I just found the answer. I didn't really want that much specificity for this. So .change I think will do the job.
creocare
Although that link is very helpful. :)
creocare
A: 
$('#imageFile').change I believe is what I needed.
creocare
A: 

To upload a file you need the server to accept it and send a response back to the browser. jQuery can then use the response to trigger an event or call a function. So the answer depends on how your server is handling the upload.

swfUpload is a popular solution that uses a small Flash movie the handling the uploading. There is a jQuery plugin for it that triggers numerous events that allow you to monitor start/progress/error/completion of the upload.

johans