Home >Backend Development >PHP Tutorial >关于网站上传不成功有关问题

关于网站上传不成功有关问题

WBOY
WBOYOriginal
2016-06-13 11:49:41876browse

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

<br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br /><html xmlns="http://www.w3.org/1999/xhtml"> <br /><head> <br /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <br /><title>无标题文档</title> <br /></head> <br /><br /><body> <br /><br /><? <br />if(@$_POST['action1']) <br />{ <br />set_time_limit(60); <br />for($i=1;$i<3;$i++) <br />{ <br />echo "<br>"; <br />$file="file"; <br />$file=$file.$i; <br />@$file_tmp=$_FILES["$file"]["tmp_name"]; <br />if (empty($file_tmp)){  <br />echo '临时目录为空';<br />exit();<br /><br />}<br /><br />@$file_name=$_FILES["$file"]["name"]; <br />$path="up\\"; <br />$ext=end(explode(".",$file_name)); <br />$file_new_name=time().".".$ext; <br />$filea=$path.$file_new_name; <br /><br />if(copy($file_tmp,$filea)) <br />    { <br />    echo "successful"; <br /><br />    echo "<br>"; <br /><br />    echo "<img  src='up/$file_new_name\' alt="关于网站上传不成功有关问题" >"; <br />    } <br />    else <br />    { <br />    echo "fail!!"; <br />    exit(1); <br />    } <br />     <br />} <br />} <br /><br />else <br />{ <br />?> <br /><br /><form action="" method="post" enctype="multipart/form-data"> <br /><input type="hidden" name="MAX_FILE_SIZE" value="800000"> <br /><input type="hidden" name="action1" value="1"> <br />file1:<input type="file" name="file1" > <br />file2:<input type="file" name="file2"> <br /><input type="submit" value="上传"> <br /></form> <br /><br /><? <br />} <br />?> <br /></body> <br /></html> <br />

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn