I am forced to use version 2 of AWS S3 because I cannot upgrade PHP to 5.5 on this server to use version 3.
I made this PHP script to download files from AWS, which works well:
$command = $s3Client->getCommand('GetObject', array(
'Bucket' => $bucket,
'Key' => $objectKey,
'ResponseContentDisposition' => 'attachment; filename="' . $originFilename . '"'
));
$signedUrl = $command->createPresignedUrl('+1000 minutes');
$file = file_get_contents($signedUrl);
The problem is that I want to be sure that it file_get_contents()downloads the entire file and detects and corrects any error (for example, the server shuts down at boot time, etc.), so I thought about the following thread:
- I ask AWS file size
- Upload file
- I check the size. If it is not i, reload the file
So how to get file size with AWS? I found this one , but it does not work for my version.