📜  aws 下载图像出现此问题 读取 PNG 图像文件的致命错误:不是 PNG 文件 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:01.131000             🧑  作者: Mango

代码示例1
Add this  function  ob_end_clean(); after set header 
=> Example  : 
 $get_document = 'assets/documents/'.$id.'/' . $file;
 if (Storage::disk('s3')->exists($get_document)) {
    $file_name  = $file;
    $type = $type;
    $headers = [
      'Content-Type' => 'application/'.$type,            
      'Content-Disposition' => 'attachment; filename="'. $file_name .'"',
    ];
    ob_end_clean();
    return \Response::make(Storage::disk('s3')->get($get_document), 200, $headers);
}