PHP程序错误:Warning: move_uploaded_file: failed to open stream:
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP程序错误:Warning: move_uploaded_file: failed to open stream:相关的知识,希望对你有一定的参考价值。
我写的一段文件上传程序,是php的程序如下:<?php
$uploaddir = '/form/upload/file/';
$uploadfile = $uploaddir. $_FILES['userfile'] ['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile'] ['tmp_name'], $uploadfile))
print "上传成功!下面是调试信息:\n";
print_r($_FILES);
else
print "上传失败,以下是调试信息:\n";
print_r($_FILES);
print "</pre>";
?>
结果出现如下错误,怎么解决?
Warning: move_uploaded_file(/form/upload/file/IPMSG.exe): failed to open stream: No such file or directory in f:\我的学习\it\php\web\form\upload\upload-2.php on line 13
Warning: move_uploaded_file(): Unable to move 'D:\DOCUME~1\alexzhao\LOCALS~1\Temp\php96.tmp' to '/form/upload/file/IPMSG.exe' in f:\我的学习\it\php\web\form\upload\upload-2.php on line 13
很感谢楼下的两位的回答,可是我试过了,还是不行。
第三位朋友的答案我也试过了,不行啊!!!!!!
改成
$uploaddir = './form/upload/file/';
$uploaddir = '../form/upload/file/';
试试。本回答被提问者采纳 参考技术B 应该是权限的问题,修改上传目录的权限。就可以了。 参考技术C 用绝对路径
以上是关于PHP程序错误:Warning: move_uploaded_file: failed to open stream:的主要内容,如果未能解决你的问题,请参考以下文章
Laravel的Warning: require..../vendor/autoload.php错误的解决办法
PHP错误Warning: Cannot modify header information - headers already sent by解决方法