1 回答
TA贡献1851条经验 获得超3个赞
我不记得确切的修复程序,但我相信我滥用了.以下是更正后的 PHP 代码:storage_path
public function uploadPostImage(Request $request)
{
$request->validate([
'upload_image' => 'required|image|mimes:jpeg,jpg,png|max:2048',
]);
$id = mt_rand(100000000000, 999999999999); # TODO: This is hacky, fix down the road
if (!is_dir(storage_path("app/public/post-images"))) {
mkdir(storage_path("app/public/post-images"), 0775, true);
}
// Upload Avatar (IMAGE INTERVENTION - LARAVEL)
Image::make($request->file("upload_image"))->save(storage_path("app/public/post-images/".$id.".png"));
session()->flash("message", "Image uploaded successfully.");
return redirect()->back();
}
我使用了相同的 Docker 映像和 Docker 撰写文件,这意味着它必须已通过正确使用进行修复。storage_path
- 1 回答
- 0 关注
- 75 浏览
添加回答
举报