如何在php mysql中上传文件?

Basically I have written a small piece of code for uploading files. The path originally is var/www/html/uploads where the files should get uploaded but so far the file does not get uploaded to this particular folder. I have tried everything from removing creating a separate directory to checking whether it is a directory or not, but still does not give me any clue as to where I am going wrong. Any suggestions would be of great help.

Here is the code:

 <?php
     session_start();

      $user_id = $_SESSION['uid'];
      $file_path ='/uploads';
      include('db.php');
?>

<!DOCTYPE html>
 <html>

 <head>

     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     <meta name="viewport" content="width=device-width,initial-scale=1" />
      <link rel="stylesheet" type="text/css" href="style.css"/>

   </head>

   <body>   
   <br/><br/><br />
      <div id="mainContent">
          <form action = "<?php echo $_SERVER['PHP_SELF'];?>" method="POST" enctype="multipart/form-data">
            Select File : 
            <input type = "file" name = "files"><br />
            <input type = "submit" value = "Upload" name = "upload">
         </form>


        <?php   

            if(isset($_POST['upload']) && $_POST['upload'] == 'Upload') 
            { 
                $tmp_file = $_FILES['files']['tmp_name'];
                $file_name = $_FILES['files']['name'];
                $file_size = $_FILES['files']['size'];
                $file_type = $_FILES['files']['type'];
                if(move_uploaded_file($tmp_file, $file_path.'/'.$file_name))        
               { 

                 $sqlInsert = "INSERT INTO download_content(uid, file_name, file_type, file_size, file_path) VALUES('$user_id','$file_name','$file_type','$file_size','$file_path')";


                $result = mysql_query($sqlInsert) or die(mysql_error());
                if($result)  
                {

                    echo '<br/><hr>';
                    echo 'File Name  : '.$file_name.'<br/><hr>';
                    echo 'File size : '.$file_size. 'bytes'.'<br/><hr>';    
                    echo 'File type : '.$file_type.'<br/><br/>';


                    /*$id = mysql_insert_id();*/
                    $sqlSelect = "SELECT * from download_content WHERE uid = '$user_id' order by file_id desc limit 1";
                    $query = mysql_query($sqlSelect) or die(mysql_error());

                    if(mysql_num_rows($query) >= 1) {

                        $row = mysql_fetch_array($query);

                    }
                }
                else { 
                    echo 'error uploading';
                }
            }
        }
        ?>


    </div>
 </body>
 </html>