Answer the question
In order to leave comments, you need to log in
File upload fails, why?
When the file is loaded, nothing happens, and the picture does not get into the umpload, why if all the paths are registered?
class ImageController extends Controller
{
public function upload(Request $request){
$path = $request->file('image')->store('upload','public');
return redirect()->route('home.image');
}
}
@isset($path)
<div class="avatar__image"><img src="{{asset('/storage/'.$path->avatar)}}" class="img-fluid" alt=""></div>
@endisset
<div class="container">
<form action="{{route('image.upload')}}" method="post" enctype="multipart/form-data">
{{csrf_field()}}
<div class="form-group">
<input type="file" name="image"><br>
<button class="btn btn-secondary" type="submit"> отправить</button>
</div>
</form>
Route::get('/', '[email protected]');
Route::get('/home', '[email protected]')->name('home.image');
Route::post('/image/upload', '[email protected]')->name('image.upload');
Route::auth();
Answer the question
In order to leave comments, you need to log in
physically the file is created? created di upload folder? if so, does it have access rights (chmod)? is php artisan storage:link written?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question