Sen Sen - 3 months ago 14
PHP Question

Php-opencloud Object Storage download file, GuzzleStream, how to>

How do I download my object using Php-opencloud?

In the documentation I see.

$stream = $openstack->objectStoreV1()

It return GuzzleStream Object.
How do I popup a screen for prompting file download?

When I Try to echo the stream, it returns garbled text
%PDF-1.4 %�쏢 5 0 obj .........

Sen Sen

I just add a header and flush the buffer

header('Content-Disposition: attachment; filename=' . basename($request));
    header("Content-Type: ".$mime);
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . $file->getSize());

    echo $file;

$file is my stream