我有一个PHP文件上传脚本,可以将文档放到S3上,目前用户可以从SQL列表中删除文件,但不能直接从S3中删除。是否有一种简单的方法可以在下面的代码中添加从S3中删除的功能?
其他php脚本包括s3.php,如果有帮助的话。
$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);
}
}
}