Reputation: 4918
I have a form that uploads a file:
<form action="uploadImage.php" method="post" enctype="multipart/form-data" id="UploadForm">
<input type="file" id="fileInput" name="ImageFile" help_token="upload_token" size=20 />
<input type="submit" id="SubmitButton" help_token="upload_token" value="Upload" />
</form>
The first input generates the Choose File button, which invokes the users Explorer to go find a file. The selected file becomes the "name" variable when the form is submitted with Upload. The "File upload was successful" message is echoed by uploadImage.php after a successful upload. The problem is that this "success" message is present from the last upload until the Upload button is clicked again to upload a new file. UploadImage.php then immediately clears the message and after uploading the new file, updates the message (success or fail).
But I don't like having the message there when the user clicks Choose File and is off selecting a new file to upload. It looks like he's done something to already upload the file before choosing it. So I'd like to sense the click of Choose File and clear out the message. But this Choose File button is generated by the browser and doesn't seem to have anything in the DOM that I can intercept with jQuery.
Does anyone have any ideas on how I can clear out the success message when Choose File is clicked?
Thanks
Upvotes: 0
Views: 53
Reputation: 407
use onclick=""
<input type="file" id="fileInput" name="ImageFile" help_token="upload_token" size=20 onclick="ClearLabel();" />
function ClearLabel(){// clear label code goes here.
}
good luck...
Upvotes: 1