Monday, May 20, 2024
74
rated 0 times [  78] [ 4]  / answers: 1 / hits: 39559  / 10 Years ago, mon, october 20, 2014, 12:00:00

So I have my implementation of this tutorial here: http://www.dropzonejs.com/bootstrap.html



It is working great, and I'm uploading files just fine. What I want to do now is be able to send a user id along with the image in the POST data when Dropzone uploads the image. I did find enyo's tutorial here which explains how to add hidden form data to the dropzone, but using the bootstrap tutorial dropzone provides, there is no form and therefore no hidden post data can be sent.



How can I use the code from the bootstrap tutorial linked to above, and yet still send hidden input data to the upload script? Do I have to somehow convert the code provided into a form, and if so, how would I do that?


More From » twitter-bootstrap

 Answers
19

It's been a while since you asked this question but based on the dropzone website tips



http://www.dropzonejs.com/#tips



you should be able to do one of 3 things -



1. if there is a form add hidden params.



2. you can use params like so -



new Dropzone({
url: /,
params: {
foo: bar
}
});


3. handle the on sending event like so -



myDropzone.on(sending, function(file, xhr, formData) { 

// Will sendthe filesize along with the file as POST data.

formData.append(filesize, file.size);

});

[#69071] Friday, October 17, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ryanulyssesb

Total Points: 91
Total Questions: 105
Total Answers: 102

Location: England
Member since Tue, Sep 8, 2020
4 Years ago
ryanulyssesb questions
Sat, Mar 20, 21, 00:00, 3 Years ago
Mon, Sep 14, 20, 00:00, 4 Years ago
Mon, Mar 9, 20, 00:00, 4 Years ago
Sun, Jul 7, 19, 00:00, 5 Years ago
;