From 170aac94d2239358e5fa979ddcd60bd5a22c1e46 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 12 Jul 2017 14:17:33 -0400 Subject: [PATCH] Reset input --- src/popup/app/vault/vaultAttachmentsController.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/popup/app/vault/vaultAttachmentsController.js b/src/popup/app/vault/vaultAttachmentsController.js index 9e930fa0..348c651f 100644 --- a/src/popup/app/vault/vaultAttachmentsController.js +++ b/src/popup/app/vault/vaultAttachmentsController.js @@ -37,7 +37,8 @@ angular return; } - var files = document.getElementById('file').files; + var fileEl = document.getElementById('file'); + var files = fileEl.files; if (!files || !files.length) { toastr.error(i18nService.selectFile, i18nService.errorsOccurred); return; @@ -54,6 +55,12 @@ angular }); $analytics.eventTrack('Added Attachment'); toastr.success(i18nService.attachmentSaved); + + // reset file input + // ref: https://stackoverflow.com/a/20552042 + fileEl.type = ''; + fileEl.type = 'file'; + fileEl.value = ''; }, function (err) { if (err) { toastr.error(err);