upload upload url upload method POST data data file file formDataAppen

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
$upload.upload({
url: "/upload",
method: 'POST',
data: data,
file: file,
formDataAppender: function(formData, key, value){
// key => 'stuff'
// value => { 'foo': 'bar' }
for (k in value) {
var dataKey = key + "[" + k + "]"; // => "stuff[foo]"
formData.append(dataKey, value[k]); // => sets "stuff[foo]=bar" - the correct way to send the form data
}
}
})