I am experiencing an issue when try to upload file of 4Mb to s3 bucket using php sdk. This is working fine in my vagrant environment. But when I try on ec2 production server, it gives below error when I am going to upload even 2Mb size of file. But small size of files can be uploaded without problem. Can someone please help me on this? I am using nginx for both environments.
$s3 = \App::make('aws')->createClient('s3');
$name= time() . $file->getClientOriginalName();
$resp = $s3->putObject(array(
'Bucket' => 'xxxxxx',
'Key' => $folder.'/' . $name,
'ACL' => 'public-read',
'Body' => new Stream(fopen(realpath($file->getPathName()), 'r'))
));
if ($resp['@metadata']['statusCode'] == 200) {
return [
"file_path"=>$resp['ObjectURL'],
"s3_key"=>$folder.'/' . $name
];
}else{
return false;
}
Error executing "PutObject" on "https://xxxxxxx.amazonaws.com/documents/1564900266slides.zip"; AWS HTTP error: Client error: PUT https://xxxxxxx.amazonaws.com/documents/1564900266slides.zip
resulted in a 400 Bad Request
response: RequestTimeoutYour socket connection to the server wa (truncated...) RequestTimeout (client): Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed. - RequestTimeoutYour socket connection to the server was not read from or written to within the timeout period.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire