我试图在ionic4应用程序中上传图像,并且我通过邮递员测试了API,并且可以正常工作,但是当我尝试提交图像时,它在浏览器中显示了422错误
邮递员中的发布请求:
标题:
Accept: application/json
Content-type: application/json
Authorization: *************
身体:
Form-data
avatar_image: file
响应:
{
"success": true,
"url": "*****************************************************",
"message": "User avatar updated successfully"
}
从浏览器控制台:
浏览图像时:
File
lastModified: 1543997285000
name: "****.png"
size: 314991
type: "image/png"
webkitRelativePath: ""
按上传时:
headers: Object { normalizedNames: Map(0), lazyUpdate: null, lazyInit: lazyInit() }
ok: false
status: 422
statusText: "Unprocessable Entity"
type: 2
url: "********************************************"