![](/img/trans.png)
[英]GWT FileUpload - Set the response Content-Type through Client code
[英]Purpose of Content-Type undefined in AngularJS FileUpload
为了将文件从angular上传到Spring MVC REST WebService,人们似乎在AJAX请求中设置了Content-Type:undefined头。
这种内容类型的目的是什么?Spring MultiPart需要它吗?
$http.post(uploadUrl, fd, {
transformRequest : angular.identity,
headers : {
'Content-Type' : undefined
}
//...
}
它将重置默认标头'application / json',让浏览器为我们填写正确的Content-Type,以及正确的边界参数。
例如,手动设置为“multipart / form-data”将无法添加已提到的边界。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.