Config::$file_size) { // Filesize is configured in config, defined in bytes. return false; // Return false when upload fails. } if (empty($errors)) { // Do fileupload // move_uploaded_file is self-explanatory. We move the file into the correct path. $makeUpload = move_uploaded_file($tempname, $uploadPath); if (!$makeUpload) { return false; // Return false when upload fails. } else { // Add information to the database. Alter::insertImage($randomname . '.' . $extension, $type); // Return where the image was uploaded to. return Config::$sys_url.Config::$file_path.$randomname.'.'.$extension; } } } }