PHP 错误.一个月前相同的代码曾经工作过,现在它显示错误.copy(): 文件名不能为空 [文件]


PHP error.. the same code used to work a month before and now its showing an error.. copy(): Filename cannot be empty [file]

I jus 已经开始收到错误数组 ( [类型] => 2 [消息] => copy(): 文件名不能为空 [文件] =>/home/fraptech/public_html/notredamedelhi.com/modifyhome.php [行] => 73 ) 即HTTP_POST_FILES行一个月前,文件上传成功。这个问题现在才开始。从那以后我就没有修改过代码。

<?php
if ($_POST['Upload']) 
{
$file_name = $HTTP_POST_FILES['ufile']['name'];
$new_file_name="slider_photo1.jpg";
$path= "images/".$new_file_name;
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "Successful<BR/>"; 
}
 else
{
echo "Error ";
print_r(error_get_last());
}

请帮助代码。

我可以猜到,php版本已在服务器上更新。

b/c $HTTP_POST_FILES 已弃用。(PHP 4>= 4.1.0, PHP 5)

http://php.net/manual/en/reserved.variables.files.php。

所以这不存在。

4.1.0 引入了 $_FILES 不推荐使用 $HTTP_POST_FILES。