reset file inputs to allow reuploading the same file again

This commit is contained in:
zadam 2019-12-28 19:29:52 +01:00
parent a9b8e65c9b
commit b8d6ff0542
2 changed files with 8 additions and 2 deletions

View File

@ -39,8 +39,11 @@ class NoteDetailFile {
});
this.$uploadNewRevisionInput.on('change', async () => {
const fileToUpload = this.$uploadNewRevisionInput[0].files[0]; // copy to allow reset below
this.$uploadNewRevisionInput.val('');
const formData = new FormData();
formData.append('upload', this.$uploadNewRevisionInput[0].files[0]);
formData.append('upload', fileToUpload);
const result = await $.ajax({
url: baseApiUrl + 'notes/' + this.ctx.note.noteId + '/file',

View File

@ -48,8 +48,11 @@ class NoteDetailImage {
});
this.$uploadNewRevisionInput.on('change', async () => {
const fileToUpload = this.$uploadNewRevisionInput[0].files[0]; // copy to allow reset below
this.$uploadNewRevisionInput.val('');
const formData = new FormData();
formData.append('upload', this.$uploadNewRevisionInput[0].files[0]);
formData.append('upload', fileToUpload);
const result = await $.ajax({
url: baseApiUrl + 'images/' + this.ctx.note.noteId,