danialfarid / ng-file-upload

Lightweight Angular directive to upload files with optional FileAPI shim for cross browser support
MIT License
7.87k stars 1.6k forks source link

multipart upload to s3 #2105

Open wholeinsoul opened 5 years ago

wholeinsoul commented 5 years ago

I looked at quite a few issues on multipart upload to s3 but none of them clearly indicated if the library supports it and some of them are quite old too. @danialfarid : can you please clarify/point me to an example of doing a multipart upload to s3 bucket with this library. Thanks.

ramanjitsingh commented 5 years ago

Do we have any input on this? I also have a use case to upload a file (> 5GB) from browser using this library. I am get the following error on uploading a file greater than 5 GBs. We need to upload using multipart uploads if the file size id greater than 5 GB

    <Error>
        <Code>EntityTooLarge</Code>
        <Message>Your proposed upload exceeds the maximum allowed size</Message>
        <ProposedSize>25063886961</ProposedSize>
        <MaxSizeAllowed>5368730624</MaxSizeAllowed>
        <RequestId>XXXXXXXX</RequestId>
        <HostId>e4nlABVQFOV2kPmIo14o2CX3ZGt2IN5KAnvNUOxUegecQPykCUhezFs5kKE9s9nep8mYCl0K7+0=</HostId>
        </Error>

I am using following code snippet. Note: I have set the content-range to 25 GB in the policy

Upload.upload({
    url: result.url, //s3Url
    transformRequest: function(data, headersGetter) {
        var headers = headersGetter();
        delete headers.Authorization;
        return data;
    },
    fields: result.fields, //credentials
    method: 'POST',
    file: files[i]
}).progress(function(evt) {
evt.index = i;
deferred.notify(evt);
}).success(function(data, status, headers, config) {
result.index = i;
deferred.resolve(result);
}).error(function(err) {
deferred.reject(err);
});