Skip to content

BlendedByChris/plUploadifyPlugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

plUploadifyPlugin

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.

Installation

1. Install the plugin

To install the plugin just use the following in your /plugins directory:

2. Publish your assets

./symfony plugin:publish-assets

2. Enable the plugin

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

3. Add the widget to your form

class FormForm extends BaseFormForm
{
  public function configure()
  {
    $this->useFields(array('widget'));

    $this->widgetSchema['widget'] = new sfWidgetFormInputUploadify();
    $this->validatorSchema['widget'] = new sfValidatorFile();
  }
}

4. Create your upload action

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!

Thanks to Frantic on IRC and Johannes for some code I took from
sfWidgetFormInputSWFUploadPlugin

About

plUploadifyPlugin is plugin that allows you to use the Uploadify javascript library with as a Symfony widget.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages