am having a lot of headache trying to pass values to upload.php
I have tried various ways to pass one parameter but it is always empty in upload.php.
I have seen the sample but I failed to get it right nor all the other tutorials outthere helped me out.
here is the code i am using
$(document).ready(function() {
$("#UploadImages").fileUpload({
'uploader': '/mysite/fbox/uploader.swf',
'cancelImg': '/mysite/fbox/cancel.png',
'script': '/mysite/fbox/upload.php',
'folder': '1502',
'multi': true,
'buttonText': 'Add Photos',
'checkScript': '/mysite/fbox/check.php',
'displayData': 'percentage',
'scriptData': {'serah':1502},
'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
'simUploadLimit': 2,
onError: function (a, b, c, d) {
if (d.status == 404)
alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');
else if (d.type === "HTTP")
alert('error '+d.type+": "+d.status);
else if (d.type ==="File Size")
alert(c.name+' '+d.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB');
else
alert('error '+d.type+": "+d.text);
},
});
});
function startUpload(id){
$('#UploadImages').fileUploadSettings('scriptData',"serah="+id);
//alert('&name='+$('#name3').val()+'&location='+$("#location").val());
$('#UploadImages').fileUploadStart();
}
And in the body section, I am trying both:
<div id="UploadImages">Photo Uploader Error</div>
<a href="javascript:startUpload(1502)">Start Upload</a>
<a href="javascript:$('#UploadImages').fileUploadStart()">Start Upload</a> | <a href="javascript:$('#UploadImages').fileUploadClearQueue()">Clear Queue</a></p>
</div>
I am having to Start Upload commands because I want to try them both but both failed. By the way, even the following variable don't go to upload.php
'folder': '1502',
and upload.php is
<?php
require('../konfig.php');
// JQuery File Upload Plugin v1.4.1 by RonnieSan - (C)2009 Ronnie Garcia
//I want to upload the files to folder 1502 which I must get from GET or POST as it varies from call to call.
if (!empty($_FILES)) {
require(DB);
$workingon=mysql_real_escape_string($_POST[serah]);
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = GROUPPICTURES.$workingon."/";
//WHERE GROUPPICTURES is a constant defined in konfig.php
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
// Uncomment the following line if you want to make the directory if it doesn't exist
// mkdir(str_replace('//','/',$targetPath), 0755, true);
move_uploaded_file($tempFile,$targetFile);
}
echo '1';
?>