$errors[] = "Email appears suspicious."; } $mailLog = dirname(dirname(dirname(__DIR__))) . '/logs/mail.log'; if (!file_exists($mailLog)) { touch($mailLog); } $send = mail($to, $subject, $message, $headers); if (!$send) { $errors[] = "Unable to send message."; } } if (isset($_FILES) && !empty($_FILES['filename'])) { $destination = dirname(dirname(__DIR__)) . '/uploads/'; try { $upload = new FileUploader($destination); $upload->setMaxSize($max); $upload->allowAllTypes(); $upload->setNotTrusted(); $upload->upload(); $results = $upload->getMessages(); } catch (FolderException $e) { $errors[] = $e->getMessage(); } } $fileError = error_get_last(); if (!empty($fileError)) { $errors[] = $error['message']; } } $errorList = $userList = $resultList = ''; if (!empty($results)) {
public function setUploads() { $destination = dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'public/uploads/'; try { $upload = new FileUploader($destination, $this->customerData['files']); $upload->setMaxSize($this->customerData['MAX_FILE_SIZE']); $upload->upload(); $result = $upload->getMessages(); $result = implode($result); $this->logger->addInfo($result); $this->data['r'] = ['uploadResults' => $result]; } catch (FolderException $e) { $this->errors[] = $e->getMessage(); } $error = error_get_last(); if (!empty($error)) { $this->errors['type'] = $error['type']; $this->errors['message'] = $error['message']; $this->errors['file'] = $error['file']; $this->errors['line'] = $error['line']; } if (!empty($this->errors)) { $this->errorRunner->runErrors($this->errors); } }