2016-08-09 3 views
1

私がしようとしているが動作しませんが、何らかの理由でそれが動作しませんLaravelのダウンロードには、データをダウンロードしようとしているに

ビュー

@foreach($files as $file) 

    {!! Html::link('public/'.$file->name, $file->name) !!} 

@endforeach 

コントローラ

public function download($file_name){ 
    $file_path = public_path('/'.$file_name); 
    return response()->download($file_path); 
} 

ルート

Route::get('download/{file}','[email protected]'); 

このエラーが発生する

NotFoundHttpException in RouteCollection.php line 161 

in RouteCollection.php line 161 
at RouteCollection->match(object(Request)) in Router.php line 821 
at Router->findRoute(object(Request)) in Router.php line 691 
+0

* *は機能しません。何かエラーが出ますか? – nix9

+0

このエラーが発生しています – OunknownO

答えて

2

パスが間違っている、あなたは/download/{file}を観察したが/public/{file}を呼び出しています。

{!! Html::link('download/'.$file->name, $file->name) !!} 
関連する問題