title: Symfony2: upload a file using a file upload plugin
body: <p>I want to upload a text file received via AJAX request in Symfony2 (using Uploadify 2.1.4). How can I process it in an action? I've found some info in the <a href="http://symfony.com/doc/2.0/cookbook/doctrine/file_uploads.html" rel="nofollow">official docs</a>, but I guess it is not what I'm looking for.</p>
  
  <p>For instance, I processed such a situation in Zend Framework this way:</p>
  
  <pre><code>    $adapter = new Zend_File_Transfer_Adapter_Http();
      $adapter-&gt;setFilters(array(
          'Rename' =&gt; array(
              'target'    =&gt; sprintf('%s/%d_%s', Zend_Registry::get('config')-&gt;uploads-&gt;uploadPath, time(), $adapter-&gt;getFileName(null, false), 'UTF-8'),
              'overwrite' =&gt; true,
          ),
      ));
      try
      {
          $adapter-&gt;receive();
      }
      catch (Zend_File_Transfer_Exception $e)
      {
          throw new Zend_Controller_Action_Exception(sprintf('Bad file: %s', $e-&gt;getMessage()));
      }
  </code></pre>