this is the error i get
Error executing "PutObject" on "https://s3.ap-south-1.amazonaws.com/infosecure.buck/uploads/5th.jpg"; AWS HTTP error: Client error: PUT https://s3.ap-south-1.amazonaws.com/infosecure.buck/uploads/5th.jpg
resulted in a 403 Forbidden
response: AccessDeniedAccess Denied69DC61 (truncated...) AccessDenied (client): Access Denied - AccessDeniedAccess Denied69DC6155E0F5042AHg2jvV2iLEsOHnmsvxM2meASpYr9Z3I6zPxEPedneHixIaPZpfESW1/SCO0UwlVnTKBXwkatE0M=
<?php
use Aws\S3\Exception\S3Exception;
require 'app/start.php';
if(isset($_FILES['file']))
{
$file=$_FILES['file'];
$name= $file['name'];
$tmp_name = $file['tmp_name'];
$extension = explode('.',$name);
$extension=strtolower(end($extension));
$key = md5(uniqid());
$tmp_file_name= "{$key}.{$extension}";
$tmp_file_path = "files/{$tmp_file_name}";
move_uploaded_file($tmp_name,$tmp_file_path);
try{
$s3->putObject([
'Bucket' => $config['s3']['bucket'],
'Key' => "uploads/{$name}",
'Body' => fopen($tmp_file_path,'rb'),
'ACL' => 'public-read'
]);
unlink($tmp_file_path);}
catch(S3Exception $e)
{
echo $e->getmessage();
}
}
?>
this is my bucket policy
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::601825519382:user/admin-infosecure" }, "Action": "s3:*", "Resource": "arn:aws:s3:::infosecure.buck" } ] }