doushi2047 2014-07-28 12:45
浏览 45
已采纳

下载图片Laravel Google App Engine

I am trying to download image stored in Google Cloud Storage Bucket. I am using following code:

$headers = array(
    'Content-Type'=> 'image/jpeg',
    'Content-Disposition' => 'attachment; filename=test.jpg',
    'Expires' => '0',
    'Content-Length' => filesize($pathToFile),
    'Content-Transfer-Encoding' => 'binary',
    'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',
);

return Response::download($pathToFile, 'test.jpg', $headers);

I checked $pathToFile is good and i am getting a valid filesize.

But I am unable to download file.

I checked App Engine Logs.

appengine.ERROR: exception 'ErrorException' with message
'fopen(php://output): failed to open stream: Unknown stream type
php://output.' in
/base/data/home/apps/s~red-flamingo/1.377568004893744378/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/BinaryFileResponse.php:254
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleError(2, 'fopen(php://out...', '/base/data/home...', 254, Array) 
#1 /base/data/home/apps/s~red-flamingo/1.377568004893744378/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/BinaryFileResponse.php(254):
fopen('php://output', 'wb') 
#2/base/data/home/apps/s~red-flamingo/1.377568004893744378/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php(374):
Symfony\Component\HttpFoundation\BinaryFileResponse->sendContent() 
#3/base/data/home/apps/s~red-flamingo/1.377568004893744378/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(608):
Symfony\Component\HttpFoundation\Response->send()
#4 /base/data/home/apps/s~red-flamingo/1.377568004893744378/public/index.php(49):
Illuminate\Foundation\Application->run()  #5 {main} [] []
  • 写回答

1条回答 默认 最新

  • dongmeng1402 2014-07-28 17:11
    关注

    php://output is unfortunately not supported (see https://code.google.com/p/googleappengine/issues/detail?id=10298). Please use print or echo instead.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端