dimanche 23 juillet 2017

How to display pdf in browser?

I need to show pdf online in the user browser, but I couldn't make it works.

My controller :

public function showJournal($file) {
        $filepath = Storage::disk('jurnal')->get($file);

        return (new Response($filepath, 200))
                        ->header('Content-Type', 'application/pdf');
    }

The route :

Route::get('view_journal/{file}', 'JournalController@showJournal')->name('showjurnal');

The view :

<iframe src="" frameborder="0" style="width:100%;min-height:640px;"></iframe>

The codes above doesn't work as it always returning error NotFoundHttpException in RouteCollection.php line 161:. The file is stored in public/jurnal. How do I solve this error ? thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire