Example of using sfWidgetFormInputFileEditable to add images in Symfony 1.4


/ Published in: Symfony
Save to your folder(s)

Example provides working solution to uploading and editing files in Symfony.


Copy this code and paste it in your HTML
  1. $logoPicFileSrc = '/uploads/'.$this->getObject()->partner_logo_pic;
  2. $this->widgetSchema['logo_pic'] = new sfWidgetFormInputFileEditable(array('file_src' => logoPicFileSrc,
  3. 'is_image' => true,
  4. 'edit_mode' => !$this->isNew(),
  5. 'delete_label' => 'Usu� obrazek'));
  6.  
  7. $this->validatorSchema['logo_pic'] = new sfValidatorFile(array(
  8. 'mime_types' => 'web_images',
  9. 'path' => sfConfig::get('sf_upload_dir'),
  10. 'required' => false));
  11. $this->validatorSchema['logo_pic_delete'] = new sfValidatorBoolean();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.