Here is the small steps to upload images or any file into amazon S3 server:-
<?php
define('awsAccessKey', 'AKIAJMEIK5LU3NAR3BTQ');
define('awsSecretKey', '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');
function copyImagetoAmazon($imageFile) {
require_once('S3.php');
$bucket = 'acrmvideos/';
$s3 = new S3(awsAccessKey, awsSecretKey);
$fileName = 'test.png';
$fileTempName = $imageFile;
$s3->putBucket($bucket, S3::ACL_PUBLIC_READ);
if ($s3->putObjectFile($fileTempName, $bucket, $fileName, S3::ACL_PUBLIC_READ)) {
$message = "File uploaded successfully.";
}else{
$message = "File not uploaded. Please try again!!";
}
echo $message;
}
copyImagetoAmazon('a.png');
?>
0 Comment(s)