fix: 下载文件出现文件损坏的情况

This commit is contained in:
kuaifan
2022-12-18 16:02:57 +08:00
parent e18fcd5c43
commit f0d0ee69c8
5 changed files with 24 additions and 10 deletions

View File

@@ -970,7 +970,10 @@ class DialogController extends AbstractController
return Redirect::to(FileContent::toPreviewUrl($array));
}
//
return Response::download(public_path($array['path']), $array['name']);
$filePath = public_path($array['path']);
return Response::streamDownload(function() use ($filePath) {
echo file_get_contents($filePath);
}, $array['name']);
}
/**