【发布时间】:2014-01-15 07:26:40
【问题描述】:
得到以下错误
无法创建“http://website.com/public/uploads/”目录
我的代码:
$file = Input::file('upload');
$file_name = $file->getClientOriginalName();
$file_size = round($file->getSize() / 1024);
$file_ex = $file->getClientOriginalExtension();
$file_mime = $file->getMimeType();
if (!in_array($file_ex, array('jpg', 'gif', 'png'))) return Redirect::to('/')->withErrors('Invalid image extension we just allow JPG, GIF, PNG');
$newname = $file_name;
$file->move(URL::to('/').'/uploads/', $newname);
上传文件夹存在。
【问题讨论】:
-
听起来目录不可写。尝试 chmod 777 或 755 并将您的网络服务器用户作为目录所有者。另外:在尝试移动文件时,您应该使用绝对文件路径而不是 URL。