title: Symfony 2 - UploadedFile, move method failed - Unable to create directory...
body: <p>I'm learning Symfony 2, and I have trouble with the class UploadedFile. 
  I want to handle file uploading in my projet so I learned thanks to the official documentation : <a href="http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html" rel="noreferrer">How to handle File Uploads with Doctrine</a></p>
  
  <p>It works pretty good. However, it works just in local. I use MAMP for testing my project. </p>
  
  <p>I tried to put my project in Debian 6 server. The Symfony app works, but the upload file doesn't work. 
  When I move the file with the method move() ... I have this error :</p>
  
  <pre><code>Unable to create the &amp;quot;/var/www/project/Symfony/src/project/Bundle/AlbumBundle/Entity/../../../../../web/images/postes_images&amp;quot; directory (500 Internal Server Error)
  </code></pre>
  
  <p>As I told you, It works very well in local. If the folder postes_images doesn't exist, it supposed to create by itself. It works well in local... </p>
  
  <p>This is my upload function:</p>
  
  <pre><code>public function upload($indexPoste, $indexPic)
  {
      if (null === $this-&gt;file) {
         return;
      }
  
      $this-&gt;name = "poste_".$indexPoste."_pic_".$indexPic;
      $this-&gt;path = "poste_".$indexPoste."_pic_".$indexPic.".".$this-&gt;file-&gt;getClientOriginalExtension();
      $this-&gt;file-&gt;move($this-&gt;getUploadRootDir(), $this-&gt;path);
  
      $this-&gt;file = null;
  }
  </code></pre>
  
  <p>Functions to get paths :</p>
  
  <pre><code>public function getUploadRootDir()
  {
      return __DIR__.'/../../../../../web/'.$this-&gt;getUploadDir();
  }
  
  protected function getUploadDir()
  {
      return 'images/postes_images';
  }
  </code></pre>
  
  <p>The paths are correct, because it works very well in local. I'm wondering if it's not a problem of configuration of php ... 
  I made some searchs, and I read that in move method, they call "mkdir" method to create the folder if it doesn't exist... If the mkdir call returns false, it returns the error that I put above. </p>
  
  <p>If you have an idea how to resolve this issue please. I couldn't find anything.</p>
  
  <p>Thanks</p>