Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

81 lines (50 sloc) 2.295 kb


Add multiple uploads to your models using this plugin's widgets and validators


With git

git submodule add git:// plugins/sfUploadPlugin
git submodule init
git submodule update

With subversion

svn propedit svn:externals plugins

In the editor that's displayed, add the following entry and then save


Finally, update:

svn up


In your config/ProjectConfiguration.class.php file, make sure you have the plugin enabled.


Publish your assets

./symfony plugin:publish-assets

Clear your cache

./symfony cc


This plugin is very simple, and provides two very useful classes for attaching multiple files to an object

  • sfWidgetFormInputFileMultiple
  • sfValidatorFileMultiple

In order to use these classes, you must have a field of type array on your model. This should be done in config/doctrine/schema.yml. Note: this field type is only available with doctrine objects. Read more on array field types here

      type:     array
      default:  null

Set the widget and validator to sfWidgetFormInputFileMultiple and sfValidatorFileMultiple in your model's form class

class MyModelForm extends BaseMyModelForm
  public function configure()
    $this->setWidget('uploads', new sfWidgetFormInputFileMultiple());
    $this->setValidator('uploads', new sfValidatorFileMultiple());


This class extends sfWidgetFormInputFile and has the following additional options:

  • max - the max number of uploads allowed on the object. Set to null if there is no maximum
  • disable_js - enable this to use the plugin without javascript enabled.


This class extends sfValidatorFile and has the following additional options:

  • max - the max number of uploads allowed on the object. Displays the max error message if it fails
Jump to Line
Something went wrong with that request. Please try again.