jQuery
function uploadpho(){
$foldername=$("#storeloyaltyid").val();
$('#uploadpho').uploadify({
uploader:urljs+"/jslib/clUploadify.swf",
cancelImage:urljs+"/image/cancel.png",
buttonImage:urljs+"/image/browse_button.png",
'scriptData' :{folder:$("#storeloyaltyid").val()},//photoxyz
uploadUrl:urljs+"/jslib/uploadify.php",
formData : jQuery.parseJSON('{"folder":"'+$("#storeloyaltyid").val()+'"}'),
onComplete: function(event,status,data,imgs){
//alert($foldername);
$("#uploadpho").val(imgs);
},
onRemove:function(event,imgs){
$("#uploadpho").val(imgs);
}
});
}
上传 php
<?php
if (!empty($_FILES)) {
$filename = $_FILES['Filedata']['name'];
$filetmpname = $_FILES['Filedata']['tmp_name'];
$fileType = $_FILES["Filedata"]["type"];
$fileSizeMB = ($_FILES["Filedata"]["size"] / 1024 / 1024);
$targetPath=$_POST['folder'];//not able to get the value here??
if($targetPath==''){
$targetPath='tmp';
mkdir('../uploaded_photos/' .$targetPath, 0755, true);// comes to loop and creates a tmp folder
}else{
mkdir('../uploaded_photos/' .$targetPath, 0755, true);
}
// Place file on server, into the images folder
move_uploaded_file($_FILES['Filedata']['tmp_name'], "../uploaded_photos/".$targetPath.'/'.$filename);
//echo $filename;
}elseif($_POST['d']){
$filename = $_POST['d'];
$dFile = "../uploaded_photos/".$filename;
unlink($dFile);
}
?>
我需要知道如何将值从 jquery uploadify 传递到 uploadify.php 以获取文件夹名称