Vue-dropzone: Is there a way to upload a file without form data?

Created on 26 Jan 2019  路  7Comments  路  Source: rowanwins/vue-dropzone

All the CSV I have uploaded to S3 contains form data, is there a way to remove the form data beforehand? Or upload the file as binary.

This is what my CSV looks like.

Content-Disposition: form-data; name="file"; filename="low_stock.csv"
Content-Type: text/csv

RANK    ASIN    JAN ITEM_NAME
1   123123  4549292084726   item1

Most helpful comment

Thanks to @kmi17, it's working!

@clinton-publift , this is how I fixed it:

 <vue-dropzone
                  id="dropzone"
                  ref="dropzone"
                  v-on:vdropzone-sending="sending"
 ></vue-dropzone>

Vue
methods:{
 sending(file, xhr, formData) {
      var _send = xhr.send;
      xhr.send = function() {
        _send.call(xhr, file);
      };
    }
}

All 7 comments

I just found this https://github.com/aws/aws-sdk-js/issues/547#issuecomment-86404872 which suggest that I am serializing my form and need to supply the File object. Is there a way to provide just the File object?

 options: {
        url: "s3://presigned-url",
        maxFiles: "1",
        thumbnailWidth: "100%",
        autoProcessQueue: false,
        method: "put",
        dictDefaultMessage:
          "<i class='fa fa-cloud-upload'></i>UPLOAD SHIFT REPORT",
        acceptedFiles:
          "text/csv,.csv,.xls,.xlsx.,.doc,.docx, application/msword,application/msword",
        maxFilesize: 10 //MB
      }

Im also encountering the same issue.

@rowanwins is there a way not to serializing the entire form? I tried to overwrite the file form data during vdropzone-sending event and that didn't work,

I used this hack: https://github.com/enyo/dropzone/issues/590#issuecomment-51498225
It works.

Thanks to @kmi17, it's working!

@clinton-publift , this is how I fixed it:

 <vue-dropzone
                  id="dropzone"
                  ref="dropzone"
                  v-on:vdropzone-sending="sending"
 ></vue-dropzone>

Vue
methods:{
 sending(file, xhr, formData) {
      var _send = xhr.send;
      xhr.send = function() {
        _send.call(xhr, file);
      };
    }
}

I used this hack: https://github.com/enyo/dropzone/issues/590#issuecomment-51498225
It works.

That links gives a 404 :(

Was this page helpful?
0 / 5 - 0 ratings