vishesh
vishesh

Reputation: 2045

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

Upvotes: 0

Views: 3196

Answers (1)

vishesh
vishesh

Reputation: 2045

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

Upvotes: 0

Related Questions