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 official docs, but I guess it is not what I'm looking for.
For instance, I processed such a situation in Zend Framework this way:
$adapter = new Zend_File_Transfer_Adapter_Http();
$adapter->setFilters(array(
'Rename' => array(
'target' => sprintf('%s/%d_%s', Zend_Registry::get('config')->uploads->uploadPath, time(), $adapter->getFileName(null, false), 'UTF-8'),
'overwrite' => true,
),
));
try
{
$adapter->receive();
}
catch (Zend_File_Transfer_Exception $e)
{
throw new Zend_Controller_Action_Exception(sprintf('Bad file: %s', $e->getMessage()));
}
I found the following simple solution. Maybe it'll be of help to somebody. ;)
The frontend part:
The backend part:
The issue is closed!