0

我在服务器上使用 zend 框架上传 mutilply 文件时遇到问题

实际上我的代码在本地主机上正常工作,但在远程服务器上它给了我应用程序错误消息

我的主机是 ipage.com

$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination('projects\\'.$_pId);
// $_pid is my project folder where all files related to it uploded
$files = $upload->getFileInfo();
$i = 1;$g = 1;
foreach ($files as $file => $info)
{
    // i have three kinds of images
    // innerfinishingphotos_ images which can be more than 1 file eg :innerfinishingphotos_1, innerfinishingphotos_2, innerfinishingphotos_3.
    // outerfinishingphotos_ images which can be more than 1 file eg :outerfinishingphotos_1, outerfinishingphotos_2, outerfinishingphotos_3.
    // _main_photo image an image.

    // here i made if statements to determine which file came from which input file 

    if( $info == $files["innerfinishingphotos_".$i] && $info["name"] ==  $files["innerfinishingphotos_".$i]["name"] && !empty( $info["name"] ) )
    {
        $filename = "inner_finishing".$_pId.uniqid().$files["innerfinishingphotos_".$i]["name"];
        $upload->addFilter('Rename', $filename, $files["innerfinishingphotos_".$i]);
        $photodata =  Array ("project_id"=> $_pId, "photo_link"=> "/projects/".$_pId."/".$filename, "photo_name"=> "inner_finishing");
        $projectModel->addInProjectGalary($photodata);
        $i++;
    }
    else if( $info == $files["outerfinishingphotos_".$g] && $info["name"] == $files["outerfinishingphotos_".$g]["name"] &&!empty( $info["name"] ) )
    {
        $filename = "outer_finishing".$_pId.uniqid().$files["outerfinishingphotos_".$g]["name"];
            $upload->addFilter('Rename', $filename, $files["outerfinishingphotos_".$g]);
            $photodata =  Array ("project_id"=> $_pId, "photo_link"=> "/projects/".$_pId."/".$filename, "photo_name"=> "outer_finishing");
            $projectModel->addInProjectGalary($photodata);
            $g++;
    }
    else if ($info == $files["_main_photo"] && !empty( $info["name"] ))
    {
        $filename = "main_photo".$_pId.uniqid().$files["_main_photo"]["name"];
            $upload->addFilter('Rename', $filename, $files["_main_photo"]);
            $photodata =  Array ("project_id"=> $_pId, "photo_link"=> "/projects/".$_pId."/".$filename, "photo_name"=> "project_photo");
            $projectModel->addInProjectGalary($photodata);  
    }

    //then i receive the image
    if($upload->isValid($file))
    {
        try {
            $upload->receive($file);  
            }
            catch (Exception $e) {
                echo "upload exteption";
            }   
    }
}

我测试了这段代码,我在本地主机上正常工作,所有图片都上传了,它们的数据进入了我的数据库

但在我的远程主机 'ipage.com' 上不起作用。

请大家帮帮我

4

1 回答 1

0

经过几个小时的尝试,我解决了这个问题,它就在这条线上

$upload->setDestination('projects\\'.$_pId);

将其更改为

$upload->setDestination('projects/'.$_pId);

谢谢先生。蒂姆喷泉

于 2012-06-09T11:21:08.140 回答