function setUploadAWS($ORIGEM, $DESTINO, $DIR) {
$BUCKET = 'some-bucket';
$ACCESS_KEY = "some-access-key";
$SECRET_KEY = "some-secret-key";
$credentials = new Aws\Credentials\Credentials($ACCESS_KEY, $SECRET_KEY);
try {
$s3 = new S3Client([
'version' => 'latest',
'region' => 'us-east-1',
'credentials' => $credentials
]);
$result = $s3->putObject([
'Bucket' => $BUCKET,
'Key' => $DIR . $DESTINO,
'SourceFile' => $ORIGEM,
]);
} catch (S3Exception $e) {
echo $e->getMessage() . "\n";
}
用于上传图片的aws代码可以通过localhost上传文件,但无法将文件上传到系统。
1条答案
按热度按时间7eumitmz1#
解决方案是将参数allow_url_fopen和allow_url_include更改为 On:
参数列于php.ini中。