Answer the question
In order to leave comments, you need to log in
Form multiple, if you leave the field empty on submit, then an error occurs, who will tell you why?
There is a form:
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="cover[]" multiple/>
<input type="submit" value="Отправить">
</form>
$files = $request->file('cover');
Argument 1 passed to Illuminate\Http\UploadedFile::createFromBase() must be an instance of Symfony\Component\HttpFoundation\File\UploadedFile, null given, called in C:\webserver\data\htdocs\topnews\vendor\laravel\framework \src\Illuminate\Http\Request.php on line 415 and defined
if ($request->hasFile('cover'))
Answer the question
In order to leave comments, you need to log in
if($request->hasFile('cover')){
//тут обрабатывай файл
}
if($request->hasFile('cover')){
foreach($request->file('cover') as $file){
// $file
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question