I'm not sure what is the cause of my file upload. It's failing and redirecting back, but not with error.
Controller
public function updateLogo()
{
$inputs = Input::all();
$logo_path = Input::only('logo_path');
$cpe_mac = $inputs['cpe_mac'];
$rule = ['logo_path' => 'mimes:jpeg,bmp,png'];
$validator = Validator::make($logo_path, $rule );
if ( $validator->fails()) {
return Redirect::to($cpe_mac.'/view-profile/')->withErrors($validator)->withInput();
} else {
.....
}
View
{!! Form::open(array('url' => '/'.$cpe_mac.'/view-profile/logo/update', 'class' => 'form-horizontal', 'role' =>'form','id' => 'editLogo','file'=>true)) !!}
<input name="logo_path" type="file" required> <br><br>
<button class="btn btn-success btn-sm mr5" type="file"><i class="fa fa-user"></i> Update Logo</button>
{!! Form::hidden('cpe_mac', $cpe_mac)!!}
{{ csrf_field() }}
{!! Form::close();!!}
Did I forget something ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire