$result=move_uploaded_file($_FILES['this_file']['tmp_name'],"../uploads/{$_FILES['the_file']['name']}");
if($result){...}
请问,move_uploaded_file,的合法文件如何确定
if($result){...}
请问,move_uploaded_file,的合法文件如何确定
调试欢乐多
else
(。。get)总是跳到get里,如何理解
echo 'ok';
else
echo 'no';
{
/*处理表单,对已经长传的文件进行php处理,存到最终目录
尝试移动上传文件
['the_file'] 表单里file类型的元素,第二个['']可变,在服务器中是临时文件名,在本地计算机里是本地的文件名*/
$result=move_uploaded_file($_FILES['this_file']['tmp_name'],"../uploads/{$_FILES['the_file']['name']}");
if($result)
{
print '<p>Your file has been uploaded.</p>';
}
else//移动出错
{
print '<p style="color:red;">Your file could not be uploaded because:';
switch($_FILES['the_file']['error'])//打印错误类型
{
case 1:
print 'The file exceeds the upload_max_filesize setting in php.ini';
break;
case 2:
print 'The file exceeds the MAX_FILE_SEZE setting in the HTML form';
break;
case 3:
print 'The file was only partially uploaded';
break;
case 4:
print 'No file was uploaded';
break;
case 6:
print ' The timporary folder does not exist.';
default:
print 'Something unforeseem happened.';
break;
}
print '</p>';
}
//print '11';
}
else
{
print '<form action="upload_file.php" enctype="multipart/form-data" method="post" >
<p>Upload a file using this form;</p>
<input type="hidden" name="MAX_FILE_SIZE" value="300000"/>
<P><input type="file" name="the_file"/></P>
<p><input type="submit" name="submit" value="Upload This File"/></p> </form>';
}
注意大小写