Php 警告:move_upload_file():copy()函数的第二个参数

Php 警告:move_upload_file():copy()函数的第二个参数,php,Php,我正在研究一种文件上传方法。但我突然发现以下错误,我唯一更改的是文件名。我将其还原,但错误仍然存在 有人知道如何解决这个问题吗 错误消息是: 警告:移动上传的文件():复制()的第二个参数 函数不能是中的目录 /hermes/bosnaweb14a/b1717/ipg.plantationkeyartcorn/kittyrescuetnr/docs/upload.php 第13行 警告:移动上传的文件():无法在中将“/tmp/phpJki8OC”移动到“/” /hermes/bosnaweb1

我正在研究一种文件上传方法。但我突然发现以下错误,我唯一更改的是文件名。我将其还原,但错误仍然存在

有人知道如何解决这个问题吗

错误消息是:

警告:移动上传的文件():复制()的第二个参数 函数不能是中的目录 /hermes/bosnaweb14a/b1717/ipg.plantationkeyartcorn/kittyrescuetnr/docs/upload.php 第13行

警告:移动上传的文件():无法在中将“/tmp/phpJki8OC”移动到“/” /hermes/bosnaweb14a/b1717/ipg.plantationkeyartcorn/kittyrescuetnr/docs/upload.php 第13行 失败

我的php看起来像这样

<?php 
$file_upload="true";
$file_up_size=$_FILES['file_up'][size];
$file_destination=$REQUEST['file_type'];
$file_new_name=$REQUEST['file_name'];


$file_name=$_FILES[file_up][name];
**$add="$file_destination/$file_new_name"; // the path with the file name where the file will be stored**

if($file_upload=="true"){

if(move_uploaded_file ($_FILES[file_up][tmp_name], $add)){
echo print_r($file_new_name);
}else{echo "Fail";}

}else{
echo $msg;
}

 ?>

好吧,因为您使用的是超全局数组
$\u REQUEST
不正确(请注意名称中的下划线),所以
$add
变量的计算结果只是一个斜杠。这是一个根目录


因此出现了错误-它毕竟是一个目录,而且您的脚本可能无论如何都没有写入权限(这是一件好事)。

天哪,这就是为什么您不连续几天盯着代码看的原因。非常感谢。你应该使用IDE,永远忘记打字错误。