Skip to content

Instantly share code, notes, and snippets.

@odracci
Created August 5, 2010 09:06
Show Gist options
  • Save odracci/509457 to your computer and use it in GitHub Desktop.
Save odracci/509457 to your computer and use it in GitHub Desktop.
sfWidgetFormInputFileEditable
<?php
$this->widgetSchema['image'] = new sfWidgetFormInputFileEditable(array(
'label' => 'Image',
'file_src' => sprintf('/uploads/%s/%s', sfConfig::get('app_upload_image_path', 'images') ,$this->getObject()->getImage()),
'is_image' => true,
'edit_mode' => !$this->isNew(),
'template' => '<div>%file%<br />%input%<br />%delete% %delete_label%</div>',
));
$this->validatorSchema['image_delete'] = new sfValidatorBoolean();
$this->validatorSchema['image'] = new sfValidatorFile(array(
'required' => false,
'path' => sprintf('%s/%s', sfConfig::get('sf_upload_dir'), sfConfig::get('app_upload_image_path', 'images')),
'mime_types' => 'web_images',
));
@cirpo
Copy link

cirpo commented Aug 5, 2010

$this->widgetSchema['image'] = new sfWidgetFormInputFileEditable(array(
'label' => 'Avatar',
'file_src' => sfConfig::get('app_upload_image_path'). $this->getObject()->getImage()),
'is_image' => true,
'edit_mode' => !$this->isNew(),
'template' => '

%file%
%input%
%delete% %delete_label%
',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment