samedi 22 août 2015

How to show a doc , pdf or docx file stored in local storage in laravel 5

I want to show a pdf file (not downloading) which is present in /storage/app/..

for storing i 've used

public function add() {
    $file = Request::file ( 'filefield' );
    $extension = $file->getClientOriginalExtension ();
    Storage::disk ( 'local' )->put ( $file->getFilename () . '.' . $extension, File::get ( $file ) );
    $entry = new Fileentry ();
    $entry->mime = $file->getClientMimeType ();
    $entry->original_filename = $file->getClientOriginalName ();
    $entry->filename = $file->getFilename () . '.' . $extension;

    $entry->save ();

    return redirect ( 'fileentry' );
}

my view is :

@extends('app')
@section('content')

<form action="{{route('addentry', [])}}" method="post" enctype="multipart/form-data">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
    <input type="file" name="filefield">
    <input type="submit">
</form>

I want to show the uploaded doc here... after clicking the submit button

@endsection

I want to show the uploaded doc below that form



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1WKTDhs
via IFTTT

Aucun commentaire:

Enregistrer un commentaire