]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/dropzone.js
Test comment creator name truncation
[bookstack] / resources / js / components / dropzone.js
index 2b8b35081188f8754a744b5fd412a86076224670..1cac09b4a5d16e21baac1a6d2bc931b261827c7c 100644 (file)
@@ -15,6 +15,7 @@ export class Dropzone extends Component {
         this.isActive = true;
 
         this.url = this.$opts.url;
+        this.method = (this.$opts.method || 'post').toUpperCase();
         this.successMessage = this.$opts.successMessage;
         this.errorMessage = this.$opts.errorMessage;
         this.uploadLimitMb = Number(this.$opts.uploadLimit);
@@ -167,6 +168,9 @@ export class Dropzone extends Component {
     startXhrForUpload(upload) {
         const formData = new FormData();
         formData.append('file', upload.file, upload.file.name);
+        if (this.method !== 'POST') {
+            formData.append('_method', this.method);
+        }
         const component = this;
 
         const req = window.$http.createXMLHttpRequest('POST', this.url, {