Jaap Terlouw
Jaap Terlouw

Reputation: 125

Using dropzone need to add additional values

I am using dropzone to upload files and images to the DB which works perfect, I generate the dropzone div's and call the dropzone jquery function. In C# its been received by a WebMethod and files are being uploaded to the database.

Now I need to send several id with however I would like to avoid to implement a ajax call to send these id's. After read the documentation on dropzonejs I could not find a simple solution to do this.

My WebMethod does not accept parameter for now but when I have a good way to implement this on client I can add these to WebMethod.

Did I miss something or Am I only able to do this with ajax? In short looking for the "data:" object within dropzone as in ajax

Upvotes: 0

Views: 1097

Answers (1)

jinggoy
jinggoy

Reputation: 307

I am not sure if I understood your question correctly, the formData is available before each files are sent.

From Dropzone.js. Sending: Called just before each file is sent. Gets the xhr object and the formData objects as second and third parameters, so you can modify them (for example to add a CSRF token) or add additional data.

Sample usage:

sending: function(file, xhr, formData) {    
            formData.append("test",$('#test').val());
        },

Upvotes: 1

Related Questions