]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/commitdiff
Clear the file input prior to triggering it
authorJohannes Zellner <johannes@nebulon.de>
Tue, 3 May 2016 12:53:57 +0000 (14:53 +0200)
committerJohannes Zellner <johannes@nebulon.de>
Tue, 3 May 2016 12:53:57 +0000 (14:53 +0200)
This ensures the change event is fired even if the file didn't change

Fixes #2

app/index.html
app/js/app.js

index adb7591c94f2095046dea860fc974da7355395a9..93fa57e27a11e25b9d79500686c02576486e7e34 100644 (file)
         <div class="row">
             <div class="col-lg-12">
                 <center>
-                    <input type='file' v-el:upload style="display: none" id="uploadInput"/>
-                    <button class="btn btn-primary" v-on:click="upload()" id="uploadButton">Upload</button>
+                    <form id="fileUploadForm">
+                        <input type="file" v-el:upload style="display: none" id="uploadInput"/>
+                        <button class="btn btn-primary" v-on:click="upload()" id="uploadButton">Upload</button>
+                    </form>
                 </center>
                 <br/>
             </div>
index 6017d25f1cec740943d3cb97ddfb69d41ec0ae18..f207de677c914cfae4072abffd8a15b1d57b6c4e 100644 (file)
@@ -143,6 +143,9 @@ function upload() {
         });
     });
 
+    // reset the form first to make the change handler retrigger even on the same file selected
+    $('#fileUploadForm')[0].reset();
+
     app.$els.upload.click();
 }