how to file delete in s3 bucket in aws in codeigniter
//
Controller
public function seller_kichen_delete(){
$replace_image_value = $this->input->post('replace_image_value');
$data = s3_bucket_delete($replace_image_value);
}
// add this code in heleper
function s3_bucket_delete($temppath){
$bucket = "bucket-name";
try{
$s3Client = new S3Client([
'version' => 'latest',
'region' => 'us-west-2',
'credentials' => [
'key' => 'key',
'secret' => 'secret-key',
],
]);
$result = $s3Client->deleteObject([
'Bucket' => $bucket,
'Key' => $temppath,
]);
$data['message'] = "success";
} catch (Exception $e) {
$data['message'] = "false";
// echo $e->getMessage() . "\n";
}
return $data;
}
No comments:
Post a Comment
Thank You For Comment