ptamzz ptamzz - 1 year ago 100
Javascript Question

how to fire event on file select

I've a form as

<form onSubmit="return disableForm(this);" action="upload.php" method="post" name="f" id="wizecho" enctype="multipart/form-data">
<input type="file" name="file" />
<button onClick="return disableForm(this),ajaxUpload(this.form,'wizecho_upload.php', '&lt;br&gt;Uploading image please wait.....&lt;br&gt;'); return false;">
Upload Image

It is to upload an image.

Here I need to click on the button to upload the image and I've to use
event. I want to remove the upload button and as soon as the file is selected at the input, I want to fire the event. How do I do that??

Answer Source

Use the change event on the file input.

         //submit the form here
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download