tpyo / amazon-s3-php-class

A standalone Amazon S3 (REST) client for PHP 5/CURL
1.03k stars 504 forks source link

Support Multipart Upload #83

Closed daverogers closed 10 years ago

daverogers commented 10 years ago

From Amazon's REST API, supporting multipart uploads SHOULD work. I created a method called postObject() whose sole purpose is to initiate an upload (http://goo.gl/8QoNFI) and get the returned upload ID, which could be used in putObject() when uploading parts (http://goo.gl/f1d0QB). To keep it simple, I'm not doing anything but the bare requirements (no encryption, no meta data, etc)

    public static function postObject($input, $bucket, $uri)
    {
        $rest = new S3Request('POST', $bucket, $uri);
        $rest->setParameter('uploads', '');
        $rest->getResponse();
        return $rest->response;
    }

Response:

[code] => SignatureDoesNotMatch
[message] => The request signature we calculated does not match the signature you provided. Check your key and signing method.

cURL info:

POST /93F2K4M?uploads HTTP/1.1
User-Agent: S3/php
Accept: */*
Host: kd-dev-dave.s3.amazonaws.com
Date: Mon, 19 May 2014 22:21:24 GMT
Authorization: AWS AKIAJATBHXMIPX6PLAOA:uUEvM5XBYZtqLWp1Po1b/TInOA4=

Thoughts on what is going wrong?

Additional info:

tpyo commented 10 years ago

Have you added the GET parameters (upload, uploadId, partNumber) here: https://github.com/tpyo/amazon-s3-php-class/blob/master/S3.php#L2107 ?

If you can create a pull request I can have a look, I have a good idea of what needs to happen for this.

daverogers commented 10 years ago

I switched to Amazon's SDK, so I removed this class (and any work I had done to it).

When initiating an upload (which is what I was trying to do here) all you're really doing is giving them the key of the file you want to multipart upload and they send back an upload ID. THEN that is appended to putObject with the uploadID as you noted. I couldn't get an upload ID back. I read others having the same issues and no resolution, so I just switched to their SDK.

adityapooniya commented 10 years ago

How to getting the ID

daverogers commented 10 years ago

See: "I couldn't get an upload ID back. I read others having the same issues and no resolution, so I just switched to their SDK."