nginx服務 413 Request Entity Too Large 錯誤
解決:
修改Nginx的配置檔案(一般是:nginx/nginx.conf)
client_max_body_size 4m;(分塊上傳每次大小2M,這裡設定4m 夠用了)
修改後還是上傳不了,日期提示open() "/var/lib/nginx/tmp/client_body/0000000045" failed (13: Permission denied)
解決:
檢視/var/lib/nginx 目錄,許可權不足,修改為
chomd -R 755 /var/lib/nginx
laravel報錯 failed to open stream: Is a directory
解決:
呼叫 $request->file('file')->storeAs($uploadPath,$fileName)報錯
需要先呼叫isValid()驗證檔案是否存在是否可用
$request->file('file')->isValid()
// eg:
$file = $request->file('file');
if($file->isValid()){
$file->storeAs($uploadPath,$fileName);
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結