日期:2014-05-16  浏览次数:20395 次

关于网站上传不成功问题
本人的网站空间空间上传的时候echo的是"临时目录为空",这个是空间商php配置的问题吗,此程序存储目录是up文件夹。网站只要是上传都不成功,目录权限没问题。原因是?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>无标题文档</title> 
</head> 

<body> 

<? 
if(@$_POST['action1']) 

set_time_limit(60); 
for($i=1;$i<3;$i++) 

echo "<br>"; 
$file="file"; 
$file=$file.$i; 
@$file_tmp=$_FILES["$file"]["tmp_name"]; 
if (empty($file_tmp)){  
echo '临时目录为空';
exit();

}

@$file_name=$_FILES["$file"]["name"]; 
$path="up\\"; 
$ext=end(explode(".",$file_name)); 
$file_new_name=time().".".$ext; 
$filea=$path.$file_new_name; 

if(copy($file_tmp,$filea)) 
    { 
    echo "successful"; 

    echo "<br>"; 

    echo "<img src='up/$file_new_name\'>"; 
    } 
    else 
    { 
    echo "fail!!"; 
    exit(1); 
    } 
     



else 

?> 

<form action="" method="post" enctype="multipart/form-data"> 
<input type="hidden" name="MAX_FILE_SIZE" value="800000"> 
<input type="hidden" name="action1" value="1"> 
file1:<input type="file" name="file1" > 
file2:<input type="file" name="file2"> 
<input type="submit" value="上传"> 
</form> 

<? 

?> 
</body> 
</html> 

------解决方案--------------------
echo $_FILES["$file"]["error"];