8000 Allow for streaming uploads · Issue #223 · valor-software/ng2-file-upload · GitHub
[go: up one dir, main page]

Skip to content
Allow for streaming uploads #223
@tdonohue

Description

@tdonohue

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: nervgh/angular-file-upload#602

A similar solution would likely work for ng2-file-upload.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0