Если бы я нажал ссылку с url: website.com/open/pdf/Document_One_Drag_3.pdf, он откроет pdf в браузере вместо загрузки. Это мой код в Route.phpКак открыть PDF в режиме онлайн с помощью laravel 5.2?
Route::get('/open/pdf/{filename}', function($filename)
{
// Check if file exists in app/storage/file folder
$file_path = public_path('uploads/docs/'.$filename);
if (file_exists($file_path))
{
return Response::make(file_get_contents($file_path), 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'inline; '.$filename,
]);
}
else
{
// Error
exit('Requested file does not exist on our server!');
}
});
файл PDF по-прежнему загрузки и не открывается в браузере. Что не так ?
попробовать это http://stackoverflow.com/questions/25938294/laravel-display-a-pdf-file-in-storage-without -forcing-download –