title: PHP upload a file to a directory outside the webserver root
body: <p>So I have a question for you guys... I am trying to write a web site in PHP that will allow people to upload images to my server. I have the upload part working, so that's not the issue. The issue is when I try and write the uploaded files to a directory outside of apache's document root.</p>
  
  <p>Apache's document root is /var/www/, and the directory I am trying to save these images to is /mnt/storage/images/. I have created the directory, changed the group to www-data, and changed the permissions on the directory to 777 (even though I know that's horrible security wise). I tried a few things with the apache configuration file, /etc/apache2/apache2.conf, namely adding a  tag and an Alias line, but nothing seems to work. Every time I try and upload a file to the images directory, it gives me a permission error. I've even tried putting a few files there manually and navigating to the directory, using the alias, with the web browser, and I get a 403 error.</p>
  
  <p>I know I am either doing something wrong, or I haven't done something to make this work. I have googled around for help on this for a few days now, and all I find is useless information, or bits and pieces of information that barely help at all.</p>
  
  <p>Btw... I'm on Ubuntu 11.04 using Apache 2.2.17, and I have root access and all that jazz.</p>
  
  <p>Thanks,
  Robbie</p>
  
  <p>EDIT: Here is the part of the apache config that I put in:</p>
  
  <pre><code>Alias /images "/mnt/storage/images/"
  &lt;Directory "/mnt/storage/images/"&gt;
      Allow from all
  &lt;/Directory&gt;
  </code></pre>