-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Added functionality to upload files to Amazon S3 #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The thing that really sucks about AWS-SDK is the size. 260KB + for a minified version doesn't sound like a browser friendly version. |
has anyone tried this? Does it work? |
I tried your code. I created a bucket on s3, added the access-key and the secret-access-key etc but I get the error :
I've tried playing around with the uploader options and I've enabled CORS on the bucket too as follows :
Any idea how I can get this to work? Any help would be much appreciated. Thanks |
It's working. But only for file sizes < 5 MB. I'm not sure but I think I read something about a 5MB block size for uploads to S3 or something. Any idea what the issue could be ? |
Also, how do i get the file location and the name of the new file from this? Doesn't seem to return it anywhere. When the upload is complete, I'd like to store that URL in my DB as a reference... but this doesnt seem to be returning such data. |
@ooqiaDev I'm using your fork for a project I'm working on. For that, I need this library in bower. Have you already put it there or not? I hope you don't mind, but I'd like to put it there so I can use it if you don't mind. The credits obviously though, will be all yours :) |
@karan-kapoor90 Sorry for the delay.
You have to use the onErrorItem method to get the error: FileUploader.onErrorItem = function (item, response, status, headers) {
// Your code here
};
{
fileName: '' // The name of the file (I add the timestamp at the end of the name to prevent files with the same name)
bucket: '' // The bucket where the file was uploaded
folder: '' // The folder (into the bucket) where the file was uploaded
url: '' // The full URL of S3 where the file was uploaded
} You have to use the onSuccessItem method to have access to the response above: FileUploader.onSuccessItem = function (item, response, status, headers) {
// Your code here
};
|
FYI, I was getting following error while uploading files larger than 5 MB (I was using FireFox).
As it clearly stated to Expose the "ETag" header, I made following modification to S3 Bucket's CORS configuration. After this I was able to upload files larger than 5 MB.
|
any way to upload to s3, with own signed url (from other method) ? |
Thanks, guys! But I close this PR preferring to #602 |
This change includes two new parameters in the main options of FileUploader class:
s3Upload
{Boolean}
: Default false, true when using Amazon S3 upload.s3Options
{Object}
: Amazon S3 configuration.The use of the Amazon S3 upload is the same than the normal upload. FileItem are uploaded with
upload
method. When uploading all queue,uploadAll
method must be used.