I have a class created by me that uploads files. I would like to check if Input :: file ('image') exists, because if it does not exist, it does not upload the image.
Follow my code:
if(Input::has('name')){
$file = Input::file('imagem');
$uploadClass = new UploadFile();
$uploadClass->setFile($file);
$uploadClass->randomFileName();
$uploadClass->setMaxFileSize(1048576);
$uploadClass->setAcceptedExtensions(['jpg','jpeg','png','zip']);
$uploadFeito = $uploadClass->uploadFile('uploads');
if (!$uploadFeito) {
return Redirect::back()
->with('alerta_erro', $uploadClass->getMessage())
->withInput();
}
}