I have upload a PHP script file to host documents on S3, while the User can delete the file from the SQL list, but not directly from S3. Is this an easy way, I can add deletion from S3 to the same code as below
The rest of the php script includes s3.php if that helps
$bucket = 'files'; $path = 'file/'; // Can be empty '' if (isset($_GET['id'])) { $id = $_GET['id']; $path .= 'File'.$id.'/'; if (isset($_GET['action'])) { $action = $_GET['action']; if ($action = "deleteFile") { $Fileid = $_GET['Fileid']; $query = "DELETE FROM amazon_upload WHERE Upload_File_Id='".$Fileid."'"; $result = mysql_query($query); if (!$result) { die ("could not query database: <br />".mysql_error()); } $locationHeader = "Location: http://www.website.com/upload.php?id=".$id; header($locationHeader); } } }
source share