The problem below is that when the function is initiated, of course, MyInputVariable
is empty.
$(function ()
I think this is best anwser
How to submit dynamic variables with uploadifive
replace this:
'formData': {
'timestamp': '',
'token': '',
'MyNumber': $('#MyInputVariable').val(),
},
by this:
'onUpload' : function(){
$('#file_upload').data('uploadifive').settings.formData = {
'timestamp': '',
'token': '',
'MyNumber': $('#MyInputVariable').val(),
}},
and this is full code:
$(function () {
$('#file_upload').uploadifive({
'auto': false,
'dnd': true,
'checkScript': 'check-exists.php',
'onUpload' : function(){
$('#file_upload').data('uploadifive').settings.formData = {
'timestamp': '',
'token': '',
'MyNumber': $('#MyInputVariable').val(),
}},
'queueID': 'queue',
'uploadScript': 'upload.php',
'onUploadComplete': function(file, data) {console.log(data);}
});
});