Uploading File

Here, $_FILE is a two-dimensional array that stores information about an uploaded file.

To upload a large file, make sure memory_limit, post_max_size and upload_max_filesize in php.ini have been set appropriately.
After the user has chosen a file and clicked the "Submit" button, the file is copied to the server and stored as a temporary file, which is then again moved to a new location in the server. Any temporary files are automatically deleted as the PHP script exits. You must first create the directory 'upload' for this code to work.
RESETRUNFULL
upload.php:
<html> <!-- upload.php -->
<body>
<?php
   if ($_FILES["file"]["error"] > 0){
      echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
   } else {
      echo "Upload: " . $_FILES["file"]["name"] . "<br />";
      echo "Type: " . $_FILES["file"]["type"] . "<br />";
      echo "Size: ".($_FILES["file"]["size"] / 1024)." Kb<br />";
      echo "Temp file: ".$_FILES["file"]["tmp_name"]."<br />";
      if (file_exists("upload/" . $_FILES["file"]["name"])) {
         echo $_FILES["file"]["name"] . " already exists. ";
      } else {
         move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $_FILES["file"]["name"]); //returns true if successful
         echo "Stored in: upload/" . $_FILES["file"]["name"];
      }
   }
 ?> 
</body>
</html>

<!DOCTYPE html>
<html>
<head></head>
<body>
<form action="upload.php" method="post"
          enctype="multipart/form-data">
     <input type="hidden" name="MAX_FILE_SIZE" value="3000000"/>
    <label for="file">Filename:</label>
    <input type="file" name="file" /> <br />
    <input type="submit" value="Submit" />
</form>
</body>
</html>