5
I have a class created by me that uploads files. I wanted to check if Input::file('image') exists, because if it does not exist, it does not upload the image.
Just 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();  
    }
}
						
you tried to do that way ?
– Otto
I tried using Input::has('image') but n worked.
– Samuel Carvalho