場景,使用thinkphp6自帶文件上傳功能上傳圖片,保存路徑在服務器根目錄下的文件夾,如:/usr/local/nginx/html/static/images;
上傳配置文件如圖:
圖片上傳報錯,返回接口返回如圖所示:
這里沒看出什么問題,查看thinkphp日志文件
如圖:
錯誤信息:Impossible to create the root directory
linux服務器權限問題
進入目錄,修改權限
cd /usr/local/nginx/html/static/images
chmod -R 777 avatar/
再上傳文件,如圖:
解決報錯,成功上傳。
檢測服務器是否有該文件,如圖: