我一直收到错误:
警告:copy():open_basedir限制生效。文件()不是 在允许的路径内: (/home/u590953899:/tmp:/var/tmp:/opt/php-5.5/pear)in 第22行/home/u590953899/public_html/upload_rename_ac.php
第22行:
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
整个代码:
<?php
// Your file name you are uploading
$file_name = $HTTP_POST_FILES['ufile']['name'];
// random 4 digit to add to our file name
// some people use date and time in stead of random digit
$random_digit=rand(0000,9999);
//combine random digit to you file name to create new file name
//use dot (.) to combile these two variables
$new_file_name=$random_digit.$file_name;
//set where you want to store files
//in this example we keep file in folder upload
//$new_file_name = new upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path= "/cdn/uploads/".$new_file_name;
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "Successful<BR/>";
//$new_file_name = new file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
echo "File Name :".$new_file_name."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>";
}
else
{
echo "Error";
}
}
?>
我搜索了Stack Overflow并谷歌寻找某种答案,但我找不到任何东西。这真的很复杂,所以我该如何解决这个问题?