if I clicked a link with url : website.com/open/pdf/Document_One_Drag_3.pdf, it will open the pdf in the browser instead of download. This is my code in Route.php
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!');
}
});
the PDF file still downloading and not opened in the browser. What is wrong ?