Vue-dropzone: Send additional params with the images?

Created on 12 Jul 2017  路  13Comments  路  Source: rowanwins/vue-dropzone

i try to send inputs hidden As specified in documentation, but not arrives to the request.

Most helpful comment

Hi @KsCorrales

The best way to send parameters with a file is to do something in the vdropzone-sending event

eg
````
'sendingEvent': function (file, xhr, formData) {
formData.append('productid', this.someId);
}

````

All 13 comments

@KsCorrales could you post your code snippet?

inside dropzone tag

<input type="hidden" name="slotID" value="xx">
<input type="hidden" name="imgType" value="xx">

@vrajroham i use hidden inputs to send optional params as specified in documentation, the photos was send succesfull but the params not arrives.

also i try as specified dropzone documentation.

customOptionsDropzone: {
       acceptedFileTypes: 'image/*',
       useCustomDropzoneOptions: true,
       dropzoneOptions: {
            url: 'xxx',
            autoProcessQueue: false,
            params: {
                slotID:5,
                imgTipo: 4
            }
        }
 }

@KsCorrales What version of vue2-dropzone you are using? Check if it not less than V2.2.5

Hi @KsCorrales

The best way to send parameters with a file is to do something in the vdropzone-sending event

eg
````
'sendingEvent': function (file, xhr, formData) {
formData.append('productid', this.someId);
}

````

It doesn't work either the param-name nor the hidden inputs.

What doesnt work, you need to provide more details @sebnet

sorry @rowanwins ,

I just cant send additional parameters to the post. I tried:
1) hidden inputs
2) param-name
3) triggering the "sending" event. (the event doesn't get called)
My setup is just copy/paste from the docs.

<dropzone id="myVueDropzone" v-on:vdropzone-sending="fileAdded" url="http://localhost:51274/uploadasync">

On my server, I just receive the file but no additional form parameters.
I'll keep trying though

I'm using the version:
vue2-dropzone@^2.0.0

@sebnet Right now we can't reproduce the issue occurring in your case. I would suggest you upgrade the dropzone component and try again.

That fixes it. I had the idea that I had installed the latest version with the installation instructions.
Thank you.

@sebnet Great you fixed it!

Happy coding!

It worked additional parameters with [hidden inputs] .
if i use [triggering the "sending" event]. formData is empty.

'sendingEvent': function (file, xhr, formData) {
  console.log(formData); // -> {}
  formData.append('productid', this.someId);
  console.log(formData); // -> {}
} 

Please watch this video: https://youtu.be/y8ykRE1pChI
This channel has very good content related to this vue component. This issue is covered in this video

Was this page helpful?
0 / 5 - 0 ratings

Related issues

azhard4int picture azhard4int  路  6Comments

morance picture morance  路  3Comments

dainemedia picture dainemedia  路  4Comments

yhosun picture yhosun  路  5Comments

kyoukhana picture kyoukhana  路  5Comments