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);
}
});
}
Uploadify 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才能获取文件夹名称
答案 0 :(得分:0)
在旧版本的uploadify中出现此问题,稍后升级到uploadify 3.1
我可以通过scriptData获取它。