简体   繁体   中英

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

I'm using https://github.com/nervgh/angular-file-upload for my file uploads.

However, I see that the upload body is like this -

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


------WebKitFormBoundaryXjCfky7muJb4rrZu--

This makes the request size( Content-Length header) more than the file size. My server needs the fileSize as header, but also needs it to be same as the request body size. How can I either -

a) Tell angular-file-upload to only send file in body, without adding any other data

b) If a) is not possible, Get the Content_length header before upload

I fixed it by setting this on fileItem -

disableMultipart: true

It's covered in this PR on angular-file-upload https://github.com/nervgh/angular-file-upload/pull/602

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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