title: I try to upload a file, API Silex
body: <p>I use PHP/Silex to do an API.
  All my code work exept one road...
  Here my <em>index.php</em> of my API code where I've a problem:</p>
  
  <pre><code>require_once __DIR__.'/../vendor/autoload.php';  
  header("Access-Control-Allow-Origin: *");
  $app = new Silex\Application();
  
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Component\HttpFoundation\ParameterBag;
  use Symfony\Component\HttpFoundation\File\UploadedFile;
  
  
  $app-&gt;post('/upload', function (Request $request) use ($app)
         {
           $file = $request-&gt;files-&gt;get('upload');                                                                     
           if ($file == NULL)   
         {
       $send = json_encode(array("status" =&gt; "Fail"));
       return $app-&gt;json($send, 500);
         }
       else
         {
       $file-&gt;move(__DIR__.'/../files', $file-&gt;getClientOriginalName());
       $send = json_encode(array("status" =&gt; "Ok"));
               return $app-&gt;json($send, 200);
         }
         });
  $app-&gt;run();
  </code></pre>
  
  <p>When I comment this line <code>$file-&gt;move(__DIR__.'/../files', $file-&gt;getClientOriginalName());</code> the program return status, but if I let this line. I've a <code>text/html</code> in response where we can read, </p>
  
  <pre><code>..Whoops, looks like something went wrong
  FileException in File.php line 134:
  Unable to create the "/var/www/api-picShary/web/../files" directory
  in File.php line 134
  at File-&gt;getTargetFile('/var/www/api-picShary/web/../files',  'awesome.png') in UploadedFile.php line 239
  at UploadedFile-&gt;move('/var/www/api-picShary/web/../files', 'awesome.png') in index.php line 79
  at {closure}( object( Request))
  at call_user_func_array( object( Closure), array( object( Request))) in HttpKernel.php line 145
  at HttpKernel-&gt;handleRaw( object( Request), '1') in HttpKernel.php line 66
  at HttpKernel-&gt;handle( object( Request), '1', true) in Application.php line 543
  at Application-&gt;handle( object( Request)) in Application.php line 520
  </code></pre>
  
  <p>at Application->run() in index.php line 86...</p>
  
  <p>I use a form to send my file :</p>
  
  <pre><code>&lt; form action="" method="post" enctype="multipart/form-data"&gt;
  &lt; input type="file" name="upload"&gt;
  &lt; input type="submit"&gt;
  &lt; /form&gt;
  </code></pre>