小弟我下传不了文件
程序员文章站
2024-02-15 18:55:22
...
我上传不了文件
我在试上传文件,出现错误:
Warning: move_uploaded_file(upload/201006202127103745.png): failed to open stream: No such file or directory in E:\www\login\upload.php on line 28 Warning: move_uploaded_file(): Unable to move 'C:\WINDOWS\Temp\php89.tmp' to 'upload/201006202127103745.png' in E:\www\login\upload.php on line 28 save picture failed
我的代码:
if($_SERVER['REQUEST_METHOD']=='POST')
{
if(!is_uploaded_file($_FILES['file']['tmp_name']))
{
echo "fasgsdf";
exit;
}
if((($_FILES["file"]["type"]=="image/gif")||
($_FILES["file"]["type"]=="image/jpeg")||
($_FILES["file"]["type"]=="image/jpg")||
($_FILES["file"]["type"]=="image/gif")||
($_FILES["file"]["type"]=="image/png")||
($_FILES["file"]["type"]=="image/bmp"))&& ($_FILES["file"]["size"] {
if(file_exists("upload/".$_FILES["file"]["name"]))
{
echo "picture already exist";
}
else
{
$result=move_uploaded_file($_FILES["file"]["tmp_name"],"upload/".$_FILES["file"]["name"]);
if($result)
echo "save picture fuccessful";
else
echo "save picture failed";
}
}
else
{
echo "invalid file";
exit;
}
}
?>
html部分:
------解决方案--------------------
路径错了。当前目录下没有upload文件夹吧??
------解决方案--------------------
就是因为没有文件夹
我在试上传文件,出现错误:
Warning: move_uploaded_file(upload/201006202127103745.png): failed to open stream: No such file or directory in E:\www\login\upload.php on line 28 Warning: move_uploaded_file(): Unable to move 'C:\WINDOWS\Temp\php89.tmp' to 'upload/201006202127103745.png' in E:\www\login\upload.php on line 28 save picture failed
我的代码:
if($_SERVER['REQUEST_METHOD']=='POST')
{
if(!is_uploaded_file($_FILES['file']['tmp_name']))
{
echo "fasgsdf";
exit;
}
if((($_FILES["file"]["type"]=="image/gif")||
($_FILES["file"]["type"]=="image/jpeg")||
($_FILES["file"]["type"]=="image/jpg")||
($_FILES["file"]["type"]=="image/gif")||
($_FILES["file"]["type"]=="image/png")||
($_FILES["file"]["type"]=="image/bmp"))&& ($_FILES["file"]["size"] {
if(file_exists("upload/".$_FILES["file"]["name"]))
{
echo "picture already exist";
}
else
{
$result=move_uploaded_file($_FILES["file"]["tmp_name"],"upload/".$_FILES["file"]["name"]);
if($result)
echo "save picture fuccessful";
else
echo "save picture failed";
}
}
else
{
echo "invalid file";
exit;
}
}
?>
html部分:
------解决方案--------------------
路径错了。当前目录下没有upload文件夹吧??
------解决方案--------------------
就是因为没有文件夹
相关文章
相关视频
上一篇: mysql-Java入门新人求解答:如何能保存修改后的网页?求代码
下一篇: 暗藏flash播放地址