Some APIs (Amazon S3 is just one example) expect streaming uploads rather than multipart uploads. This may be the case in REST APIs which expect a file to simply be streamed instead of parsing a form.
Currently, ng2-file-upload only supports multipart form uploads. If you are using an API that expects a streamed file, you will end up with a corrupted file on the server, as the binary content includes multipart form headers. For example, after uploading an image, on the server the raw image data will look something like this (and the image will be seen as corrupted):
The same is true for all file types. The form headers will end up inserted into the raw data of the file if the server-side API is expecting the file data to be streamed.
A similar solution would likely work for ng2-file-upload.
Related to #121 , but not specific to Amazon S3.
Some APIs (Amazon S3 is just one example) expect streaming uploads rather than multipart uploads. This may be the case in REST APIs which expect a file to simply be streamed instead of parsing a form.
Currently, `ng2-file-upload` only supports multipart form uploads. If you are using an API that expects a streamed file, you will end up with a corrupted file on the server, as the binary content includes multipart form headers. For example, after uploading an image, on the server the raw image data will look something like this (and the image will be seen as corrupted):
```
------WebKitFormBoundarywMGsynmUCDADoKSG
Content-Disposition: form-data; name="file"; filename="my-image.png"
Content-Type: image/png
[actual-binary-image-data]
------WebKitFormBoundarywMGsynmUCDADoKSG--
```
The same is true for all file types. The form headers will end up inserted into the raw data of the file if the server-side API is expecting the file data to be streamed.
This same issue was recently resolved in `angular-file-upload` via this PR: https://github.com/nervgh/angular-file-upload/pull/602
A similar solution would likely work for `ng2-file-upload`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Related to #121 , but not specific to Amazon S3.
Some APIs (Amazon S3 is just one example) expect streaming uploads rather than multipart uploads. This may be the case in REST APIs which expect a file to simply be streamed instead of parsing a form.
Currently,
ng2-file-uploadonly supports multipart form uploads. If you are using an API that expects a streamed file, you will end up with a corrupted file on the server, as the binary content includes multipart form headers. For example, after uploading an image, on the server the raw image data will look something like this (and the image will be seen as corrupted):The same is true for all file types. The form headers will end up inserted into the raw data of the file if the server-side API is expecting the file data to be streamed.
This same issue was recently resolved in
angular-file-uploadvia this PR: https://github.com/nervgh/angular-file-upload/pull/602A similar solution would likely work for
ng2-file-upload.Still not resolved this issue?
Note: this issue has a proposed fix in #224, which is still under review.
This issue can be closed, as #224 was merged.