0

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

Jaap Terlouw
  • 125
  • 1
  • 15
  • Jaap, could you please share the code how your dropzone code working/calling asp.net page's webmethod. i am trying to call webmethod from dropzone (eg: url: 'abcpage.aspx/helloworld');. but not got any success so far. thanks – JSB Nov 03 '14 at 04:36

1 Answers1

1

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());
        },
jinggoy
  • 307
  • 1
  • 6
  • Hi Jinggoy, this seems to work (at least I dont get errors on the webmethod, however I do I get this parameter in my webmethod in C#? – Jaap Terlouw Aug 01 '14 at 07:53
  • Hi Jaap, not familar with Webmethod, but this is my guess. Add the parameter with the same name in the formData. For more information refer to this post: http://stackoverflow.com/questions/17655807/how-to-send-and-retrieve-data-from-web-method-using-jquery-ajax-call – jinggoy Aug 01 '14 at 08:32