samedi 25 juillet 2015

while uploading images to amazon s3 server getting InvalidAccessKeyId error how to solve this?

I tried to upload image to amazon s3 server but showing error message that is Use of undefined constant CURL_SSLVERSION_TLSv1 - assumed 'CURL_SSLVERSION_TLSv1', S3::putBucket(chlogo1, public-read, ): [InvalidAccessKeyId] The AWS Access Key Id you provided does not exist in our records. and S3::putObject(): [InvalidAccessKeyId] The AWS Access Key Id you provided does not exist in our records. here is my code

            if (!class_exists('S3'))require_once('S3.php');

        //AWS access info
        if (!defined('awsAccessKey')) define('awsAccessKey', 'my_access_key');
        if (!defined('awsSecretKey')) define('awsSecretKey', 'my_secret_key');

        //instantiate the class
        $s3 = new S3(awsAccessKey, awsSecretKey);
                        //retreive post variables
        $fileName = $_FILES['logo']['name'];
        $fileTempName = $_FILES['logo']['tmp_name'];
        //create a new bucket
        $s3->putBucket("chlogo1", S3::ACL_PUBLIC_READ);
        //move the file
        if ($s3->putObjectFile($fileTempName, "chlogo1", $fileName, S3::ACL_PUBLIC_READ)) {
            echo "<strong>We successfully uploaded your file.</strong>";
        }else{
            echo "<strong>Something went wrong while uploading your file... sorry.</strong>";
        }




Aucun commentaire:

Enregistrer un commentaire