title: How can I allow users of my website to upload media files?
body: <p>I'm currently following a tutorial for a basic media file upload form. I've tried adding it to my website, but I always get the message "There was an error uploading the file, please try again!"  when I try to upload images using it.</p>
  
  <p>I've put the following html file onto my server:</p>
  
  <pre><code>&lt;DOCTYPE! html&gt;
  &lt;html&gt;
  
  
  &lt;head&gt;
  &lt;/head&gt;
  
  
  &lt;body&gt;
  &lt;form enctype="multipart/form-data" action="uploader.php" method="POST"&gt;
  &lt;input type="hidden" name="MAX_FILE_SIZE" value="10000000" /&gt;
  Choose a file to upload: &lt;input name="uploadedfile" type="file" /&gt;&lt;br /&gt;
  &lt;input type="submit" value="Upload File" /&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  
  
  &lt;/html&gt;
  </code></pre>
  
  <p>I have then created the file uploader.php, which looks like this:</p>
  
  <pre><code>&lt;?php
  
  // Where the file is going to be placed 
  $target_path = "../uploads/";
  
  /* Add the original filename to our target path.  
  Result is "uploads/filename.extension" */
  $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
  
  
  
  if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
      echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
      " has been uploaded";
  } else{
      echo "There was an error uploading the file, please try again!";
  }
  
  ?&gt;
  </code></pre>
  
  <p>I've stored these files in the same directory. I've then created another directory called uploads - which is writable.</p>
  
  <p>Why is this not working?</p>
  
  <p>EDIT: I'm now able to upload files upto 1MB in size, but anything larger than this fails to upload. As you can see in the HTML script, I've set the max file size to 10MB - so this should work. Any idea why it isn't?</p>