Rag*_*aer 0 php upload file laravel
出现以下错误
无法创建“ 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);
Run Code Online (Sandbox Code Playgroud)
上传文件夹存在。
您正在尝试将文件移动到 URL,您必须移动到文件夹:
$file->move(base_path().'/public/uploads/', $newname);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8683 次 |
最近记录: |