plUploadifyPlugin plugin allows you to use the jQuery/Flash based file
uploader Uploadify packaged as a simple widget with minimal effort. Feel free to fork
and add more of the Uploadify options in the widget but this is all I use. I’ll
gladly merge your updates.
To install the plugin just use the following in your /plugins directory:
./symfony plugin:publish-assets
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
// for compatibility / remove and enable only the plugins you want
$this->enableAllPluginsExcept(array('sfPropelPlugin'));
}
}
./symfony plugin:publish-assets
class FormForm extends BaseFormForm
{
public function configure()
{
$this->useFields(array('widget'));
$this->widgetSchema['widget'] = new sfWidgetFormInputUploadify();
$this->validatorSchema['widget'] = new sfValidatorFile();
}
}
public function executeUpload(sfWebRequest $request)
{
$request->checkCSRFProtection();
$file = $request->getFiles("form_widget");
if (isset($file)) {
$uploadPath = sfConfig::get("sf_upload_dir");
$f = new sfValidatedFile($file["name"],
$file["type"],
$file["tmp_name"],
$file["size"],
$uploadPath);
$f->save($f->generateFilename().$f->getOriginalExtension());
}
$this->setLayout(false);
return sfView::NONE;
}
Thanks to Frantic on IRC and Johannes for some code I took from
sfWidgetFormInputSWFUploadPlugin