Javascript AJAX jQuery HTML OOPS PHP PHP Example MORE

PHP oops file upload

upload.php

<?php
class upload{
    public $src = "./upload/";
    public $tmp;
    public $filename;
    public $type;
    public $uploadfile;

    public function startupload(){
        $this -> filename = $_FILES["file"]["name"];
        $this -> tmp = $_FILES["file"]["tmp_name"];
        $this -> uploadfile = $src . basename($this -> name);
    }
    public function uploadfile(){
        if(move_uploaded_file($this -> tmp, $this -> uploadFile)){
            return true;
        }
    }


}

?>

index.php

<?php
require_once('./lib/upload.php');
?>
<?php
if(isset($_POST['file'])){
    $fileupload = new upload();
    if($fileupload -> uploadfile()){
        echo 'Success';
    }
}
?>

<html>
<head></head>
<body>
<form align="center" enctype="multipart/form-data" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
Select upload file: <input type="file" name="file" required="yes"  />
<input type="submit" value="Submit" />
<p>
</form>
</body>
</html>