背景:angular +angular material;
需求:上傳文件並傳到數據庫;
file.html:
file.ts
仔細查看請求頭,會發現content-type會跟其他的接口有不一樣:
formData對象的使用:
https://developer.mozilla.org/zh-CN/docs/Web/API/FormData/Using_FormData_Objects
背景:angular +angular material;
需求:上傳文件並傳到數據庫;
file.html:
file.ts
仔細查看請求頭,會發現content-type會跟其他的接口有不一樣:
formData對象的使用:
https://developer.mozilla.org/zh-CN/docs/Web/API/FormData/Using_FormData_Objects