繁体   English   中英

使用angular-file-upload从请求正文中删除Content-Disposition和Content-Type

[英]Remove Content-Disposition and Content-Type from request body using angular-file-upload

我正在使用https://github.com/nervgh/angular-file-upload进行文件上传。

但是,我看到上传内容是这样的-

------WebKitFormBoundaryXjCfky7muJb4rrZu
Content-Disposition: form-data; name="file"; filename="dump.rdb"
Content-Type: application/octet-stream


------WebKitFormBoundaryXjCfky7muJb4rrZu--

这使得请求大小( Content-Length标头)大于文件大小。 我的服务器需要fileSize作为标头,但也需要与请求正文大小相同。 我怎么能-

a)告诉angular-file-upload仅在正文中发送文件,而不添加任何其他数据

b)如果a)不可能,请在上传之前获取Content_length标头

我通过在fileItem上设置它来修复它-

disableMultipart: true

此PR在angular-file-upload https://github.com/nervgh/angular-file-upload/pull/602上进行了介绍

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM