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代码可以通过本地主机上传文件,但无法将文件上传到系统。
答案 0 :(得分:0)
解决方案是将参数 allow_url_fopen 和 allow_url_include 更改为 On :
const mapStateToProps = state => ({
form: state.form,
submitted: state.Orders.submitted,
initializeValues: {
//problem naming here <-----
}
});
const mapDispatchToProps = dispatch => bindActionCreators({
addDoorOrder
}, dispatch);
DoorOrders = connect(
mapStateToProps,
mapDispatchToProps
)(DoorOrders);
export default reduxForm({
form: 'Orders',
enableReinitialize: true
})(DoorOrders);
参数在php.ini上列出。
allow_url_fopen= On
allow_url_include= On