Skip to content

Commit

Permalink
Fixes #373 that caused issues adding files to already populated file …
Browse files Browse the repository at this point in the history
…uploads
  • Loading branch information
justin-schroeder committed Mar 1, 2021
1 parent a2f968d commit 22fd990
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/specimens/SpecimenFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
name="file"
type="file"
:outer-class="['file-input-2']"
:value="[{ url: 'apple.pdf' }]"
help="Select any file to upload"
validation="mime:application/pdf"
/>
Expand Down
6 changes: 5 additions & 1 deletion src/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ class FileUpload {
// Create a new mutable FileList
if (this.supportsDataTransfers) {
const transfer = new DataTransfer()
this.files.forEach(file => transfer.items.add(file.file))
this.files.forEach(file => {
if (file.file instanceof File) {
transfer.items.add(file.file)
}
})
this.fileList = transfer.files
this.input.files = this.fileList
// Reset the merged FileList to empty
Expand Down

0 comments on commit 22fd990

Please sign in to comment.