aws-amplify / aws-sdk-ios

AWS SDK for iOS. For more information, see our web site:
https://aws-amplify.github.io/docs
Other
1.67k stars 877 forks source link

Upload Image / Video from assets library to S3 #121

Closed ndbroadbent closed 9 years ago

ndbroadbent commented 9 years ago

It seems that AWSS3TransferManager does not support uploading files directly from the assets library. I'm seeing this error in my logs:

Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260.)" UserInfo=0x7ff40850a7a0 {NSFilePath=/asset.mov, NSUnderlyingError=0x7ff40850ae30 "The operation couldn’t be completed. No such file or directory"}

My AWSS3TransferManagerUploadRequest looks like this:

<AWSS3TransferManagerUploadRequest: 0x7ff4023e2d30> {
    ACL = 0;
    body = "assets-library://asset/asset.mov?id=BCDF906D-AAAA-AAAA-AAAA-3AEA235DFF35&ext=mov";
    bucket = "****-uploads";
    currentUploadingPartNumber = 0;
    key = "**********.mov";
    serverSideEncryption = 0;
    state = 0;
    storageClass = 0;
    totalSuccessfullySentPartsDataLength = 0;
}

I think it's having trouble with the assets-library:// protocol. It would be awesome if the AWS iOS SDK could handle this properly, maybe by using the getBytes function on ALAssetRepresentation.

Otherwise, how should I approach this? Should I just copy the asset data to a temporary file before each upload?

Thanks!

yosuke-matsuda commented 9 years ago

The asset library is currently not supported. You need to copy the assets to your app directory before initiating uploads. We are considering adding the assets library support in a future version.

ndbroadbent commented 9 years ago

Thanks for your help, I'll do that for now.

drmarkpowell commented 9 years ago

AWS SDK developers you should totally implement support for this, it would really help performance of apps that upload photos to the cloud!

chadnewbry commented 9 years ago

+1 would be useful.

lukeconlon commented 8 years ago

+1 also think this would make photo uploads more efficient

SebastianBO commented 8 years ago

+1

barthdamon commented 8 years ago

+1

roymckenzie commented 8 years ago

+1

ZaidPathan commented 8 years ago

+1, After Parse shutdown - AWS has good chance to pick grip on MBAAS.

dustin6464 commented 7 years ago

+1

urmi1 commented 6 years ago

@drmarkpowell @ndbroadbent Hello, I can't upload "assets-library://" Video and image directly from this URL. Can you please help me out how can i implement this functionality? Thank you.