FormData如何获取或设置multipart/form-data中的边界-Angular [英] FormData how to get or set boundary in multipart/form-data - Angular
本文介绍了FormData如何获取或设置multipart/form-data中的边界-Angular的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个微型应用程序,必须从浏览器将表单数据发布到端点.
I have a mini app, where I have to post a form data to an endpoint from browser.
这是我的帖子:
var formData = new FormData();
formData.append('blobImage', blob, 'imagem' + (new Date()).getTime());
return $http({
method: 'POST',
url: api + '/url',
data: formData,
headers: {'Content-Type': 'multipart/form-data'}
})
formData似乎将边界添加到了参数中,但是,我无法将其发送到标头中,该怎么办?
Boundaries seems to be added by formData to the parameter, however, I cannot get it to send in the header, how should I done?
推荐答案
好吧,似乎标头ContentType应该未定义,以便添加正确的边界
Well, seems that the headers ContentType should be undefined, in order to add the correct boundaries
这篇关于FormData如何获取或设置multipart/form-data中的边界-Angular的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文