Prova per il download del file

This commit is contained in:
Amministratore 2025-10-21 16:57:13 +02:00
parent fbb92e1e0c
commit 0e62b62c75
3 changed files with 8 additions and 3 deletions

View File

@ -35,5 +35,9 @@ class GenDocController extends Controller
return redirect()->back();
}
public function downloadFile($id){
$doc = Gendoc::find($id)->get();
return response()->download($doc->filename);
}
}

View File

@ -51,7 +51,7 @@
@foreach($documenti as $documento)
<tr>
<td><a href="{{ asset('storage/'.$documento->filename) }}"><i class="fas fa-fw fa-file"></i>&nbsp;{{ $documento->descrizione }}</a></td>
<td><a href="{{ route('download',['id'=>$documento->id]) }}"><i class="fas fa-fw fa-file"></i>&nbsp;{{ $documento->descrizione }}</a></td>
<td>
<a class="btn btn-primary" href="/admin/doc_update?id={{ $documento->id }}">Edit</a>&nbsp;

View File

@ -85,6 +85,7 @@ Route::middleware([
// Route::post('admin/movimenti/docs', [DocumentiController::class,'storeFile']);
Route::get('admin/movimenti/docs', [App\Http\Controllers\GenDocController::class,'fileForm'])->name('documenti');
Route::post('admin/movimenti/docs', [App\Http\Controllers\GenDocController::class,'storeFile']);
Route::get('admin/movimenti/download',[App\Http\Controllers\GenDocController::class,'downloadFile'])->name('download');
// {issue #5}
// Route::get('movimenti/docs', [DocumentiController::class,'fileMovimentiForm'])->name('documenti');