I have the following code block. Uploadify itself works fine, however the custom form data that's sending the jquery variable isn't sending to the script at all. Yet if i set it to 1 or some basic text, it works fine. Am i missing something really simple? The alert on complete shows the data fine.
jQuery:
$(function() {
var scheduledImageDesc = '';
$('#scheduledImageDesc').on("keyup change", function(e) {
scheduledImageDesc = $(this).val();
});
$('#file_upload').uploadify({
'formData' : {
'scheduledImageDesc': scheduledImageDesc,
'timestamp' : '<?php echo $timestamp;?>',
'token' : '<?php echo md5('unique_salt' . $timestamp);?>'
},
'buttonText' : 'Upload New Image',
'swf' : 'uploadify/uploadify.swf',
'uploader' : 'uploadify/uploadifyScheduledImage.php',
'fileExt' : '*.jpg; *.jpeg; *.JPG; *.JPEG;',
'multi' : true,
'auto' : true,
'fileSizeLimit' : '4MB',
//'checkExisting' : 'uploadify/check-exists-scheduled-image.php',
'onQueueComplete' : function(data) {
//location.reload();
alert(scheduledImageDesc);
}
});
});
Solved it, i had to add in another function in order to get the update from the input field i was using before it sent it. If anyone else ever gets stuck, here's what worked for me.
jQuery:
var scheduledImageDesc = '';
$('#scheduledImageDesc').on("keyup change", function(e) {
scheduledImageDesc = $(this).val();
});
$('#file_upload').uploadify({
'formData' : {
'timestamp' : '<?php echo $timestamp;?>',
'token' : '<?php echo md5('unique_salt' . $timestamp);?>'
},
'buttonText' : 'Upload New Image',
'swf' : 'uploadify/uploadify.swf',
'uploader' : 'uploadify/uploadifyScheduledImage.php',
'fileExt' : '*.jpg; *.jpeg; *.JPG; *.JPEG;',
'multi' : true,
'auto' : true,
'fileSizeLimit' : '4MB',
'onUploadStart' : function(file) {
$("#file_upload").uploadify("settings", "formData", {"scheduledImageDesc": scheduledImageDesc});
},
//'checkExisting' : 'uploadify/check-exists-scheduled-image.php',
'onQueueComplete' : function(data) {
//location.reload();
alert(scheduledImageDesc);
}
});