0

When uploading file in Vue2-Dropzone, default param name is "file". But I need to customize it as "upload".

I tried to change it using vdropzone-sending method. But It sends two params "file" and "upload".

Do I need to change backend to accept the param "file"? or Is there a way to customize default param name("file")?

<vue-dropzone v-on:vdropzone-sending="sendingEvent">
</vue-dropzone>
...
methods: {
  sendingEvent (file, xhr, formData) {
    formData.append('upload', file);
  }
}
gz89
  • 532
  • 3
  • 18

1 Answers1

0

Vue2-Dropzone is a wrapper around Dropzone.js, which has an option to change the parameter name

In order to pass that option to the Vue2-Dropzone component, you use the options prop like so:

<vue-dropzone :options="dropzoneOptions" v-on:vdropzone-sending="sendingEvent"></vue-dropzone>
...
data () {
    return {
        dropzoneOptions: { paramName: "upload" }
    }
}
nibnut
  • 3,072
  • 2
  • 15
  • 17
  • Based on your answer, I found the all configurations for Dropzone.js. https://www.dropzonejs.com/#config-paramName – gz89 Aug 26 '20 at 23:24