I have the following error that I can not solve being something so simple. I try to upload a video to later save it, but in the process I am shown the following message:
The video failed to upload.
The code of the form is as follows:
{!! Form::open(['url' => '/video/upload','method'=>'POST','enctype'=>'multipart/form-data','files'=>true]) !!}
{!! Form::token();!!}
<div class="form-group{{ $errors->has('video') ? ' has-error' : '' }}">
<div class="input-group input-file">
<span class="input-group-btn">
<button class="btn btn-default btn-choose" type="button">Choose</button>
</span>
<input type="text" class="form-control" placeholder='Selecciona un archivo...'/>
<span class="input-group-btn">
</span>
</div>
@if ($errors->has('video'))
<span class="help-block">
<strong>{{ $errors->first('video') }}</strong>
</span>
@endif
</div>
<div class="col-md-offset-11 ">
<button type="submit" class="btn btn-primary">
Enviar
</button>
</div>
{!! Form::close() !!}
The request code where it is validated is the following:
class VideoRequest extends FormRequest{
public function authorize()
{
return true;
}
public function rules()
{
return [
'video' => 'mimes:mpeg4,mp4,mov,avi|required'
];
}
public function messages()
{
return [
'mimes' => 'El archivo seleccionado no cuenta con algun formato soportado: MP4, MPEG4, MOV, AVI',
'required' => 'El campo es obligatorio'
];
}
}
The route:
Route::post('/video/upload', 'VideoController@saveVideo');
And the driver that is empty, because the request never comes
public function saveVideo(VideoRequest $request)
{
dd($request);
}
Also configure the php.ini file with the values:
post_max_size=10M
upload_max_filesize=10M