开发者

Need help transferring a jpg from web server to S3 - PHP and CodeIgniter

I have a Flash application that captures an image and passes an encoded image to my web server. The web server then decodes the image and saves it to a tmp directory. That part works fine. Next I want to move this image from the web sever to my S3 account but am having trouble. I am using the code below. Any help is appreciated.

In the CodeIgniter Controller Constructor:

    $this->load->library('S3');

In the function (also within the controller for now)

    /************** S3 upload example***************/
    if (!defined('awsAccessKey')) define('awsAccess开发者_高级运维Key', 'xxxxxxx');
    if (!defined('awsSecretKey')) define('awsSecretKey', 'xxxxxxx');

    $s3 = new S3(awsAccessKey, awsSecretKey);

    if($s3->putObjectFile($filePathTemp, "bucket", $filePathNew, "ACL_PUBLIC_READ_WRITE")){
            @unlink($filePathTemp);
    }

I can't even get the $s3 variable to return anything in an "echo" statement by returning a value on the first line of the S3 constructor. I can't access the S3 object/class, but the following statement returns a "1":

    echo "S3 --> " . class_exists('S3');

Thanks in advance for your time.

-Tim


I'm assuming (you don't say: you should specify which one) you are using this. Your usage looks correct: I'm assuming your keys are wrong. If

print_r($s3->listBuckets());

doesn't return anything check your server logs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜