title: PHP File Upload Folder
body: <p>I want to upload file with php(text file) and always this file saved as names.txt(if the file exists from previous upload i want to be replaced with the new one) to the same directory the script is located. i found the below code online from a tutorial but i can't make it work .I get no file exists. I have posted the html file and the php file from upload to help me. thank you 
  uploadfile.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;File Uploading Form&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h3&gt;File Upload:&lt;/h3&gt;
  Select a file to upload: &lt;br /&gt;
  &lt;form action="file_uploader.php" method="post"
                          enctype="multipart/form-data"&gt;
  &lt;input type="file" name="file" size="50" /&gt;
  &lt;br /&gt;
  &lt;input type="submit" value="Upload File" /&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>file_uploader.php</p>
  
  <pre><code>&lt;?php
  if( $_FILES['file']['name'] != "" )
  {
     copy( $_FILES['file']['name'], "/uploads" ) or 
             die( "Could not copy file!");
  }
  else
  {
      die("No file specified!");
  }
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Uploading Complete&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h2&gt;Uploaded File Info:&lt;/h2&gt;
  &lt;ul&gt;
  &lt;li&gt;Sent file: &lt;?php echo $_FILES['file']['name'];  ?&gt;
  &lt;li&gt;File size: &lt;?php echo $_FILES['file']['size'];  ?&gt; bytes
  &lt;li&gt;File type: &lt;?php echo $_FILES['file']['type'];  ?&gt;
  &lt;/ul&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>