내 사용자는 이미지를 AWS S3 버킷 벌금에 프로그래밍 방식으로 업로드 할 수 있습니다. 그래서프로그래밍 방식으로 Amazon S3 버킷에 PUT을 삽입 할 수 있지만 삭제하지 않을 수 있습니다.
case 'DELETE':
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
break;
내가 어떤 궁금 해요 : 그들은 파일을 삭제할 수 없습니다 -하지만 같은 PHP는 S3 클래스를 사용합니다 (풋 경우뿐만 아니라이 삭제 경우 아래를 포함하는) 포함 날카로운 눈이 내 대본에없는 것을 볼 수 있습니다. 오류 메시지가 표시되지 않습니다.
//THIS WORKS
//include the S3 class
if (!class_exists('S3'))require_once('S3.php');
//GET keys
include_once "scripts/S3k.php";
//instantiate the class
$s3 = new S3(awsAccessKey, awsSecretKey);
//assigns file location var to get
$fileTempName = $DestinationFile;
//Assigns S3 path/file name
$fileName = $path.$user_id."/".$fileName;
//Move the file over to S3
if ($s3->putObjectFile($fileTempName, $mybucket, $fileName, S3::ACL_PUBLIC_READ)) {
echo " file uploaded";
}
//THIS doesn't WORKS
//include the S3 class
if (!class_exists('S3'))require('S3.php');
//get KEYS
include "scripts/S3k.php";
//instantiate the class
$s3 = new S3(awsAccessKey, awsSecretKey);
//Assigns S3 path/file name
$fileName = $path.$user_id."/".$image_link;
//Deletes the file in S3
if ($s3->deleteObject($mybucket, $fileName)) {
echo "Deleted file.";
}
//And this GET script doesn't work either.
$image_link = "1/Bowery_3_58x46app.jpg";
$pathS3 = "http://d21v2uajc20x0x.cloudfront.net/myGallerist/artWorkImages/";
//include the S3 class
if (!class_exists('S3'))require_once('S3.php');
include_once "scripts/S3k.php";
//instantiate the class
$s3 = new S3(awsAccessKey, awsSecretKey);
// Get the file from S3
if ($s3->getObject($mybucket, $pathS3.$image_link, "tempImage/".$image_link)) {
} else {
// Couldn't move the file over.
$msgToUser = 'No file was uploaded.';
}
DELETE 요청에 대한 S3 응답의 오류 메시지를 게시하십시오. –