【问题标题】:failed to open stream : Is a directory in无法打开流:是一个目录
【发布时间】:2013-01-11 17:02:44
【问题描述】:

我在尝试使用 php 将上传的文件从临时文件夹移动到所需的文件时收到以下警告

警告:move_uploaded_file(test/) [function.move-uploaded-file]:无法打开流:是第 69 行 /home/..../filename.php 中的目录

警告:move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpKrCpQw' to 'test/' in /home/..../filename.php on line 69

以下是给出错误的第 67 和 69 行:

$destination = "test/". $name;

$answer = move_uploaded_file($_FILES['user_file']['tmp_name'],$destination);

【问题讨论】:

  • $destination 显然是'test/'$name 显然是空的。

标签: php file-upload warnings


【解决方案1】:

你的名字好像是空的

$destination = "test/". $name;

回显你的名字,看看那里有什么。

【讨论】:

  • 我收到此错误,但我的文件名结构完美且文件夹具有权限... :(
  • @NickBedford 错误仅在存在no write permissionpath is not proper 时显示。
【解决方案2】:

对我来说,就是文件大小。

因此,检查 php.ini 以查看上传的文件是否超过 upload_max_filesizepost_max_size

或者可能在 Laravel 或 js 中添加验证规则。

【讨论】:

  • 这里相同,使用 Laravel 5.6。
猜你喜欢
  • 2018-02-12
  • 2014-05-21
  • 1970-01-01
  • 1970-01-01
  • 2018-08-23
  • 1970-01-01
  • 2021-05-11
  • 2023-03-13
相关资源
最近更新 更多