php文件上传问题,求大神赐教,move_uploaded_file一直出错,该试的都试过了,一直上传不了 15
/////////表单提交时这样写的<formaction="upload.php"method="post"enctype="multipart/form-data"/...
/////////表单提交时这样写的
<form action="upload.php" method="post" enctype="multipart/form-data"/>
<div>
<input type="hidden" name="MAX_FILE_SIZE" value="10240000"
/><!--如果超过大小会报错误,不然会陷入无尽的等待,必须放前面,!!还有"MAX_FILE_SIZE"疑问-->
<input type="file" name="userfile" id="userfile"/>
<input type="submit" value="enter"/>
</div>
</form>
////////PHPupload是这样写的
<?php
header('Content-Type:text/html;charset=utf-8');
if($_FILES['userfile']['error'] > 0)
{
echo 'Problem:';
switch($_FILES['userfile']['error'])
{
case 1:echo 'File exceeded upload_max_filesize';
break;
case 2:echo 'File exceeded max_file_size';
break;
case 3:echo 'File only partlly uploaded';
break;
case 4:echo 'No file upload';
break;
case 6:echo "Can't upload file:NO temp directory specified";
break;
case 7:echo 'Upload failed:Cannot write to disk';
break;
}
exit;
}
//Does the file have the right MIME type?
if($_FILES['userfile']['type']!='text/plain')
{
echo 'Problem: file is not plain text';
exit;
}
//put the file where we'd like it
//$upfile = '/upload/'.$_FILES['userfile']['name'];
if(is_uploaded_file($_FILES['userfile']['tmp_name']))
{
//echo $_FILES['userfile']['error'].'<br/>';
if(!move_uploaded_file($_FILES['uesrfile']['tmp_name'],$_FILES['userfile']['name']))
{
echo 'Problem : Could not move file to destination directory';
exit;
}
}
else
{
echo 'Problem : Possible file upload attack .Filename:';
echo $_FILES['userfile']['name'];
exit;
}
echo 'File uploaded successfully<br/><br/>';
一直报这个错 展开
<form action="upload.php" method="post" enctype="multipart/form-data"/>
<div>
<input type="hidden" name="MAX_FILE_SIZE" value="10240000"
/><!--如果超过大小会报错误,不然会陷入无尽的等待,必须放前面,!!还有"MAX_FILE_SIZE"疑问-->
<input type="file" name="userfile" id="userfile"/>
<input type="submit" value="enter"/>
</div>
</form>
////////PHPupload是这样写的
<?php
header('Content-Type:text/html;charset=utf-8');
if($_FILES['userfile']['error'] > 0)
{
echo 'Problem:';
switch($_FILES['userfile']['error'])
{
case 1:echo 'File exceeded upload_max_filesize';
break;
case 2:echo 'File exceeded max_file_size';
break;
case 3:echo 'File only partlly uploaded';
break;
case 4:echo 'No file upload';
break;
case 6:echo "Can't upload file:NO temp directory specified";
break;
case 7:echo 'Upload failed:Cannot write to disk';
break;
}
exit;
}
//Does the file have the right MIME type?
if($_FILES['userfile']['type']!='text/plain')
{
echo 'Problem: file is not plain text';
exit;
}
//put the file where we'd like it
//$upfile = '/upload/'.$_FILES['userfile']['name'];
if(is_uploaded_file($_FILES['userfile']['tmp_name']))
{
//echo $_FILES['userfile']['error'].'<br/>';
if(!move_uploaded_file($_FILES['uesrfile']['tmp_name'],$_FILES['userfile']['name']))
{
echo 'Problem : Could not move file to destination directory';
exit;
}
}
else
{
echo 'Problem : Possible file upload attack .Filename:';
echo $_FILES['userfile']['name'];
exit;
}
echo 'File uploaded successfully<br/><br/>';
一直报这个错 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询