<!--?php require_once('aws.phar'); use Aws\Common\Aws; use Aws\Common\Enum\Region; use Aws\S3\Enum\CannedAcl; use Aws\S3\Exception\S3Exception; use Guzzle\Http\EntityBody; $access_key = 'accesskeyeyeyeyeye'; $secret_key = 'secretkeyyeyeyeye'; $region = Region::AP_NORTHEAST_1; $bucket = '3doreal'; try { // S3 $s3 = Aws::factory(array( 'key' => $access_key, 'secret' => $secret_key, 'region' => $region, ))->get('s3'); $info = new FInfo(FILEINFO_MIME_TYPE); // Upload File $filename ='3DOReal.jpg'; $filebody = EntityBody::factory(fopen($filename, 'r')); $filetype = $info->file($filename); $response = $s3->putObject(array( 'Bucket' => $bucket, 'Key' => "3DOReal.jpg", 'Body' => $filebody, 'ContentType' => $filetype, 'StorageClass' => 'STANDARD', 'ACL' => CannedAcl::PUBLIC_READ, )); } catch (S3Exception $e) { } ?>
参考サイト:
http://www.4-fusion.jp/randd/2013/05/08/hdd-old-amazon-s3-easy/