2016-07-01 3 views
1

Php-opencloudを使用してオブジェクトをダウンロードするにはどうすればよいですか? http://docs.os.php-opencloud.com/en/latest/services/object-store/v1/objects.htmlPhp-opencloudオブジェクトストレージダウンロードファイル、GuzzleStream、方法>

私が見ているドキュメントです。

$stream = $openstack->objectStoreV1() 
       ->getContainer('{containerName}') 
       ->getObject('{objectName}') 
       ->download(); 

GuzzleStreamオブジェクトを返します。 ファイルのダウンロードを促す画面をポップアップするにはどうすればよいですか?私は、ストリームをエコーし​​ようとすると

、それが文字化けしたテキストに %PDF-1.4 %�쏢 5 0 obj .........

答えて

0

を返す私はちょうど

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

    echo $file; 

$ファイルは私のストリーム

あるヘッダを追加し、バッファをフラッシュ
関連する問題