0

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 以获取文件夹名称

4

1 回答 1

0

在旧版本的uploadify中存在这个问题,后来升级到uploadify 3.1我能够通过scriptData获取它。

于 2012-06-27T04:21:42.130 回答