欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

php文件上传 [function.move-uploaded-file]: failed to open stream 错误解决办法

程序员文章站 2022-05-07 20:34:13
...
php文件上传中出现如下错误

 

Warning: move_uploaded_file(upload/pal4bz111.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory inE:\Eclipse\Workspace\PHPTest\file_upload\t2.php on line 24
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\xampplite\tmp\php7FC5.tmp' to 'upload/pal4bz111.jpg' inE:\Eclipse\Workspace\PHPTest\file_upload\t2.php on line 24
Stored in: upload/pal4bz111.jpg

 

解决办法

move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $_FILES["file"]["name"])

改为

move_uploaded_file($_FILES["file"]["tmp_name"],"d:/" . $_FILES["file"]["name"])

 

注:windows环境