It is possible to get and put objects using not stream data held in memory but files or PHP streams. This is especially useful when file sizes are large in order not to overcome memory limits.
To receive object using streaming, use method
getObjectStream($object, $filename). This method will return
Zend_Http_Response_Stream, which can be used as described in
HTTP Client Data Streaming section.
Example 774. Zend_Service_Amazon_S3 Data Streaming Example
$response = $amazon->getObjectStream("mybycket/zftest");
// copy file
// use stream
$fp = fopen("my/downloads/file2", "w");
Second parameter for
getObjectStream() is optional and
specifies target file to write the data. If not specified, temporary file is used, which
will be deleted after the response object is destroyed.
To send object using streaming, use
putFileStream() which has
the same signature as
putFile() but will use streaming and not
read the file into memory.
Also, you can pass stream resource to
putObject() method data
parameter, in which case the data will be read from the stream when sending the request
to the server.