我是亚马逊s3的新手。我将 zip 下载到我的项目中并解压缩。存储桶已创建“bucketToUpload”。我上传文件的代码是
require 'aws/aws-autoloader.php';
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
use Aws\S3\Enum\CannedAcl;
$bucket = 'bucketToUpload';
$pathToFile = getcwd().'/s3_upload_file.doc';
if(file_exists($pathToFile)) {
try {
$client = S3Client::factory(array(
'key' => 'MYKEY',
'secret' => 'MYSECRETKEY',
'region' => 'us-west-1'
));
$client->waitUntilBucketExists(array('Bucket' => $bucket));
$result = $client->putObject(array(
'Bucket' => $bucket,
'Key' => 's3_upload_file.doc',
'SourceFile' => getcwd(),
'ACL' => CannedAcl::PRIVATE_ACCESS,
'Metadata' => array(
'Foo' => 'abc',
'Baz' => '123'
)
));
} catch (S3Exception $e) {
echo "The file was not uploaded: " . $e->getMessage();
}
var_dump($result);
}
我收到 Fate 错误:超过 15 秒的最大执行时间。真的不知道我做错了什么。任何帮助都是非常可观的。
谢谢