I am using c# mvc application to develop my website.
The following code gave me some problem, because I intend to trigger the upload after user select file to upload. So I apply on changes event on my file upload.
<form style="display:inline;" enctype="multipart/form-data" action="/Admin/AddImage" method="post" id="uploadImageForm">
<input hidden name="listing_id" value="@Request.QueryString["id"]"/>
<label for="file-upload" style="width :120px" class="btn btn-default custom-file-upload">
<input name="uploaded_image" id="file-upload" type="file" onchange="document.getElementById('uploadImageForm').submit();" />
Add Image
</label>
</form>
Ok this works fine. However when I click back button on my chrome, this stupid event will trigger again so become upload twice. How I can prevent it to be happen.
The problem is, when i click back, the event will trigger when bodyonload. so the input file have the cache, so it will trigger another upload