-1

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">
Gert Grenander
  • 16,548
  • 6
  • 39
  • 43
JamesTBennett
  • 1,742
  • 5
  • 16
  • 22

3 Answers3

1

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

How can I upload files asynchronously?

Community
  • 1
  • 1
Ian Henry
  • 21,875
  • 4
  • 48
  • 61
0
$('#imageFile').change I believe is what I needed.
JamesTBennett
  • 1,742
  • 5
  • 16
  • 22
0

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
  • 16