嗨我有这个我需要更改的php,我已经复制了我的网站并将其存储在一个名为m / i的子目录中我希望能够将文件从m /目录网站上传到根目录网站。这是脚本的功能:
global $MAX_FILE_SIZE;
global $MAX_THUMB_HEIGHT;
global $MAX_THUMB_WIDTH;
global $DELETE_ORIGIN_IMAGE;
global $myfile;
$err = check_err();
if(!empty($err))
return edit_profile_form($err);
/*** Upload logo image*/
if($_FILES['business_logo'])
{
//die($MAX_FILE_SIZE.'x');
$business_logo=uploadfile("../img/consumer_user/",$_FILES['business_logo'],0,$MAX_FILE_SIZE);
}
if($business_logo=='-1')
{
$err['upload_logo'] = "<span style=\"color: red;\">- Upload error with <b>Business Logo</b>. Cannot be uploaded due to permission.</span><br>";
}
else if($business_logo=='0')
{
$err['upload_logo'] = "<span style=\"color: red;\">- Upload error with <b>Business Logo</b>. File type not allowed</span><br>";
}
else if($business_logo=='1')
{
$err['upload_logo'] = "<span style=\"color: red;\">- Upload error with <b>Business Logo</b>. File size not allowed</span><br>";
}
else if($business_logo=='2')
{
$business_logo="";
}
//echo $business_logo;
if ($business_logo)
{
if($_FILES['business_logo']['name'])
{
$myfile=str_replace(" ","_",$_FILES['business_logo']['name']);
$myfile=time()."_".$myfile;//echo $myfile;
if ($myfile)
{
//Create thumbnail
for($i=0;$i<count($MAX_THUMB_WIDTH);$i++)
{
$MAX_QUALITY[$i]=$MAX_THUMB_WIDTH[$i]>$MAX_THUMB_HEIGHT[$i]?$MAX_THUMB_WIDTH[$i]:$MAX_THUMB_HEIGHT[$i];
thumbnail_images($_FILES['business_logo'],$MAX_THUMB_WIDTH[$i] ,$MAX_THUMB_HEIGHT[$i] ,"../img/consumer_user/","thumb_".$i,$myfile);
}
if($DELETE_ORIGIN_IMAGE)
{
deletefile("../img/consumer_user/".$myfile);
}
}
}
}
if(!empty($err))
return edit_profile_form($err);
正如你所看到的那样,我试图摆脱m /通过显而易见的../但它似乎没有用。
有什么建议吗?感谢
答案 0 :(得分:1)
据我所知,访问其他目录没有问题,只要您的用户具有足够的文件访问权限。
也许尝试使用完整文件路径$_SERVER["SCRIPT_FILENAME"]
并使用绝对路径保存文件?