The author received a reply from Soen, imported to here by chance help other users.
Use the S3 class standalone (which I found is not much different from the AWS SDK) with the getObject
:
/**
* Get an object
*
* @param string $bucket Bucket name
* @param string $uri Object URI
* @param mixed $saveTo Filename or resource to write to
* @return mixed
*/
public static function getObject($bucket, $uri, $saveTo = false)
{
$rest = new S3Request('GET', $bucket, $uri, self::$endpoint);
if ($saveTo !== false)
{
if (is_resource($saveTo))
$rest->fp =& $saveTo;
else
if (($rest->fp = @fopen($saveTo, 'wb')) !== false)
$rest->file = realpath($saveTo);
else
$rest->response->error = array('code' => 0, 'message' => 'Unable to open save file for writing: '.$saveTo);
}
if ($rest->response->error === false) $rest->getResponse();
if ($rest->response->error === false && $rest->response->code !== 200)
$rest->response->error = array('code' => $rest->response->code, 'message' => 'Unexpected HTTP status');
if ($rest->response->error !== false)
{
self::__triggerError(sprintf("S3::getObject({$bucket}, {$uri}): [%s] %s",
$rest->response->error['code'], $rest->response->error['message']), __FILE__, __LINE__);
return false;
}
return $rest->response;
}
Source: https://aws.amazon.com/code/1448
With no chance of being duplicated, mine refers to the S3 of aws and not just to force the download of a file that is quite simple. But beauty.
– Vitor Schweder
Exactly, the content-type works but the file comes directly from Bucket and not from an ftp, and to force the download of an ftp for example I must give a fread at the end of the header changes or is there actually a path in the directory to the file, but in Bucket is directly in aws, I found a method in the API called saveTo(), which saves in a directory the file and this will help, I hope I have been clear, using the Bucket from aws it is easier to understand the situation of not having the physical file in an ftp. Hugs.
– Vitor Schweder
In the client, with saveTo() it was possible only on the server because it should be informed the folder that it should be saved, but this helps me because I can then read and force the download and remove that file that was saved on the server.
– Vitor Schweder
I voted to reopen because it is the S3 system. It is not duplicity.
– Guilherme Nascimento