mardi 29 décembre 2015

homestead laravel 5 : link Download file from storage

i am need hint link to download upload file, currently i am following this answer here is my code

Routes file :

Route::get('getDownload/{remind_letter}',
            ['as'=>'downloadData',
            'uses'=>'DockController@getDownload']);

Controller File :

  public function getDownload($remind_letter)
{

    $download = Dock::where('remind_letter','=',$remind_letter)->firstOrFail();
    $file =Storage::disk('local')->get($download->remind_letter);
    return (new response($file))->header('Content-Type', $entry->m1);
}

result file

<div class="row">
                <div class="form-group">
                    <div class="col-xs-5">
                    <label class="col-sm-7">Remind Letter :</label>
                    <input type="text" name="remind_letter" value="{{$getData->remind_letter}}">                    
                    </div>
                    <div><a href="{{ route('downloadData',$getData->remind_letter) }}">
                    <button class="btn btn-success btn-sm">Download</button></a></div>
                </div>
                </div>

and the result link dock.start/star/getDownload/home/vagrant/Code/dock/storage/app/25/JTK/2015/Renewal License Kaspersky/Moonarch Security/tmp/phpQaGzoD.pdf

but the link is always show up error 404 and i can't download file

FYI when upload file i am using storage_path() function



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire