Wenn ich auf einen Link mit URL: website.com/open/pdf/Document_One_Drag_3.pdf geklickt habe, wird das PDF im Browser geöffnet und nicht heruntergeladen. Dies ist mein Code in Route.phpWie öffne ich PDF online mit 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!');
}
});
die PDF-Datei noch das Herunterladen und nicht im Browser geöffnet. Was ist falsch ?
versuchen diese http://stackoverflow.com/questions/25938294/laravel-display-a-pdf-file-in-storage-without -forcing-download –