diff options
author | Johannes Zellner <johannes@nebulon.de> | 2016-05-03 14:53:57 +0200 |
---|---|---|
committer | Johannes Zellner <johannes@nebulon.de> | 2016-05-03 14:53:57 +0200 |
commit | e41fd8d870087dafded21050f7895bb179060b2f (patch) | |
tree | 9ffad758aaed544076e880043cddea8bec856fa0 | |
parent | 0cce5096940c6b5e31a2e9dce849deb79d9844ce (diff) | |
download | Surfer-e41fd8d870087dafded21050f7895bb179060b2f.tar.gz Surfer-e41fd8d870087dafded21050f7895bb179060b2f.tar.zst Surfer-e41fd8d870087dafded21050f7895bb179060b2f.zip |
Clear the file input prior to triggering it
This ensures the change event is fired even if the file didn't change
Fixes #2
-rw-r--r-- | app/index.html | 6 | ||||
-rw-r--r-- | app/js/app.js | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/app/index.html b/app/index.html index adb7591..93fa57e 100644 --- a/app/index.html +++ b/app/index.html | |||
@@ -107,8 +107,10 @@ | |||
107 | <div class="row"> | 107 | <div class="row"> |
108 | <div class="col-lg-12"> | 108 | <div class="col-lg-12"> |
109 | <center> | 109 | <center> |
110 | <input type='file' v-el:upload style="display: none" id="uploadInput"/> | 110 | <form id="fileUploadForm"> |
111 | <button class="btn btn-primary" v-on:click="upload()" id="uploadButton">Upload</button> | 111 | <input type="file" v-el:upload style="display: none" id="uploadInput"/> |
112 | <button class="btn btn-primary" v-on:click="upload()" id="uploadButton">Upload</button> | ||
113 | </form> | ||
112 | </center> | 114 | </center> |
113 | <br/> | 115 | <br/> |
114 | </div> | 116 | </div> |
diff --git a/app/js/app.js b/app/js/app.js index 6017d25..f207de6 100644 --- a/app/js/app.js +++ b/app/js/app.js | |||
@@ -143,6 +143,9 @@ function upload() { | |||
143 | }); | 143 | }); |
144 | }); | 144 | }); |
145 | 145 | ||
146 | // reset the form first to make the change handler retrigger even on the same file selected | ||
147 | $('#fileUploadForm')[0].reset(); | ||
148 | |||
146 | app.$els.upload.click(); | 149 | app.$els.upload.click(); |
147 | } | 150 | } |
148 | 151 | ||