Skip to content
This repository

Create a file called “MediaBrowserTestForm.class.php” in your lib/form folder :


<?php
class MediaBrowserTestForm extends sfForm
{
  public function setup()
  {
    $this->setWidget('image', new sfWidgetFormInputMediaBrowser());
    $this->setValidator('image', new sfValidatorMediaBrowserFile());
  }
}

Create a template file :


<form>
  <?php echo new MediaBrowserTestForm() ?>
</form>

Configure a default directory

If you want your user to browser a specific folder by default for a specific widget (let’s say /uploads/images), you should use the “dir” widget option :


<?php
class MediaBrowserTestForm extends sfForm
{
  public function setup()
  {
    $this->setWidget('image', new sfWidgetFormInputMediaBrowser(array('dir' => '/images')));
    $this->setValidator('image', new sfValidatorMediaBrowserFile());
  }
}

Notice that the “dir” option specifies a url relative to your app configuration “root_dir” (app_sf_media_browser_root_dir that is by default “/uploads”)

Something went wrong with that request. Please try again.