Skip to content

Commit e4d1049

Browse files
committed
Allow passing custom data in POST request
1 parent 8641de8 commit e4d1049

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎ui/scripts/templates.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@
110110
fileUpload: {
111111
getURL: function(args) {
112112
args.response.success({
113-
url: 'http://10.223.183.3/test-upload.php'
113+
url: 'http://10.223.183.3/test-upload.php',
114+
data: {
115+
testData1: '1',
116+
testData2: '2'
117+
}
114118
});
115119
},
116120
postUpload: function(args) {

‎ui/scripts/ui/dialog.js‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,17 @@
701701
var $file = $form.find('input[type=file]');
702702
var $field = $file.closest('.form-item .value');
703703

704+
// Add additional passed data
705+
$.map(successArgs.data, function(v, k) {
706+
var $hidden = $('<input>').attr({
707+
type: 'hidden',
708+
name: k,
709+
value: v
710+
});
711+
712+
$hidden.appendTo($frameForm);
713+
});
714+
704715
$uploadFrame.css({ width: $field.outerWidth(), height: $field.height() }).show();
705716
$frameForm.append($file);
706717
$field.append($uploadFrame);

0 commit comments

Comments
 (0)