tzmartin/Ti-Amazon-S3

No errors but fails to upload

Opened this issue · 5 comments

Hi, just installed this, got it working no problems except that it will start the upload I get a progress in the console but then nothing, sometimes the one progress notice I get will be 0.00001 etc and sometimes a -0.000468928483 I'm guessing I should be seeing multiple progress notices? There is no other debug messages. I'm running this on 2.1 SDK iOS 5.1

Am getting this error in the callback:

Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred" UserInfo=0x1024c70 {NSUnderlyingError=0x1023a20 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1005.)", NSLocalizedDescription=A connection failure occurred}

Right then, managed to successfully upload on the simulator (not tried on device yet) but I had to allow everyone upload permissions - which seems daft to me as I set the keys.
Also, the actual upload has no permissions in the console, but is able to be viewed in the browser. Go figure.

Any help much appreciated.

Hi Ian. Your bucket needs a bucket policy to control read/write access. You could either create a "grantee" of "Everyone" and add a upload/delete policy. Or you can create a bucket policy object.

I'm using a policy on mine, and deleted the grantee. Here's what my object looks like for my public bucket:

{
    "Version": "2008-10-17",
    "Id": "Policy1341944972665",
    "Statement": [
        {
            "Sid": "Stmt1341944963203",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::bucket001.sempress/*"
        }
    ]
}

The only action needed is GetObject.

You can create policies using the policy generator. This article is helpful:
http://www.jppinto.com/2011/12/access-denied-to-file-amazon-s3-bucket/

Try that and tell me if it works. If not, I'll try to debug further.

Hi,
Thanks for coming back to me. Spotted the policy, but didn't quite do it the same as you have described, have updated that now.
But get this. I'm not sure if this is an appcelerator thing or what, but at work this works perfectly, I can upload from the simulator, I can see the image in the bucket everything.
I come home, and whilst the upload process tells me "1" I get a success, no image arrives in my bucket. On the device, (I can only install to device at home), from the console I can see the upload has started, it gets to 0.039 - 0.059 every time and then just hangs. This is also evident on 3G - So to rule out my wifi and anything strange going on there.

[EDIT: Both environments are the same, 2.1.0 latest titanium etc, same XCODE etc]

I am at a complete loss!

if anyone on this thread is still interested in this module, pull down the latest version and try it again. It works now well on iOS and Android :-)