簡體   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