Allow passing custom data in POST request

This commit is contained in:
Brian Federle 2015-01-19 11:35:17 -08:00
parent 8641de85d2
commit e4d1049096
2 changed files with 16 additions and 1 deletions

View File

@ -110,7 +110,11 @@
fileUpload: {
getURL: function(args) {
args.response.success({
url: 'http://10.223.183.3/test-upload.php'
url: 'http://10.223.183.3/test-upload.php',
data: {
testData1: '1',
testData2: '2'
}
});
},
postUpload: function(args) {

View File

@ -701,6 +701,17 @@
var $file = $form.find('input[type=file]');
var $field = $file.closest('.form-item .value');
// Add additional passed data
$.map(successArgs.data, function(v, k) {
var $hidden = $('<input>').attr({
type: 'hidden',
name: k,
value: v
});
$hidden.appendTo($frameForm);
});
$uploadFrame.css({ width: $field.outerWidth(), height: $field.height() }).show();
$frameForm.append($file);
$field.append($uploadFrame);