Skip to content

Commit

Permalink
fix empty upload_path (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
djoeycl authored Apr 17, 2023
1 parent caf85e4 commit d430dff
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/resources/assets/js/modules/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ export default {
sending: function (file, xhr, formData) {
uploadProgress += parseFloat(100 / allFiles)
manager.progressCounter = `${Math.round(uploadProgress)}%`

//fix if Dropzone doesnt find the form. This only happens if you use direct drag and drop on the div (__stack-container).
if (!formData.has('upload_path')) {
try {
let path = document.querySelector("#new-upload input[name='upload_path']").value;
if (path !== '') {
formData.append('upload_path', path);
}
} catch (error) {
console.debug(error);
}
}

// send files custom options
formData.append('custom_attrs', JSON.stringify(manager.uploadPreviewOptionsList))
Expand Down

0 comments on commit d430dff

Please sign in to comment.