enctype和Content-type有什么关系

enctype和Content-type有什么关系

当我们使用form表单上传文件时post请求的时候,需要在form表单中添加enctype="multipart/form-data"属性。
请求头中有一个Content-type字段,会声明数据编码格式。
如果form中没有指定enctype,浏览器会自动添加默认的content-type:application/x-www-form-urlencoded;charset=utf-8。

使用antd upfile组件的时候,它会自动添加enctype为"multipart/form-data"
enctype和Content-type

猜你喜欢

转载自www.cnblogs.com/hideonbush/p/9845252.html