Re: [symfony-users] How to delete uploaded images when deleting records
If you are using sf 1.3 or. 1.4, then you have postDelete hook in your propel sent via htc magic On Dec 24, 2009 4:48 AM, "Serkan Koyuncu" wrote: Hi, If you're using Doctrine, you can create public function postDelete($event) { @unlink(sfConfig::get('sf_upload_dir').'/immobili/original/'.$this->fotoPrincipale); @unlink(sfConfig::get('sf_upload_dir').'/immobili/big/'.$this->fotoPrincipale); } in your model file. If you're using Propel, you can extend delete method of your model file or create another behaviour. Thanks. 2009/12/23 ilcaduceo : > Hi all, I've a simple form with sfFormWidgetInputFileEditable for > simple upload of photos: > > $... -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
Re: [symfony-users] How to delete uploaded images when deleting records
Hi, If you're using Doctrine, you can create public function postDelete($event) { @unlink(sfConfig::get('sf_upload_dir').'/immobili/original/'.$this->fotoPrincipale); @unlink(sfConfig::get('sf_upload_dir').'/immobili/big/'.$this->fotoPrincipale); } in your model file. If you're using Propel, you can extend delete method of your model file or create another behaviour. Thanks. 2009/12/23 ilcaduceo : > Hi all, I've a simple form with sfFormWidgetInputFileEditable for > simple upload of photos: > > $this->validatorSchema['fotoPrincipale'] = new sfValidatorFile(array( > 'required' => false, > 'path' => > sfConfig::get('sf_upload_dir').'/immobili/original', > 'mime_types' => 'web_images', > 'validated_file_class' => 'sfResizedFile' > )); > > $this->widgetSchema['fotoPrincipale'] = new > sfWidgetFormInputFileEditable(array( > 'label' => 'Foto principale', > 'file_src' => '/uploads/immobili/big/'.$this->getObject()- >>getFotoPrincipale(), > 'is_image' => true, > 'edit_mode' => !$this->isNew(), > 'with_delete' => false, > 'template' => '%file%%input%%delete% > %delete_label%' > )); > > I've also an admin generated backend interface, but I want to delete > the photo uploaded when the record is deleted. > > How to this? Thanks for help me... > > -- > > You received this message because you are subscribed to the Google Groups > "symfony users" group. > To post to this group, send email to symfony-us...@googlegroups.com. > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
Re: [symfony-users] How to delete uploaded images when deleting records
I did not go through your code, how are you storing images in the db, using file paths? On Wed, Dec 23, 2009 at 7:54 AM, ilcaduceo wrote: > Hi all, I've a simple form with sfFormWidgetInputFileEditable for > simple upload of photos: > > $this->validatorSchema['fotoPrincipale'] = new sfValidatorFile(array( >'required' => false, >'path' => > sfConfig::get('sf_upload_dir').'/immobili/original', >'mime_types' => 'web_images', >'validated_file_class' => 'sfResizedFile' > )); > > $this->widgetSchema['fotoPrincipale'] = new > sfWidgetFormInputFileEditable(array( > 'label' => 'Foto principale', > 'file_src' => '/uploads/immobili/big/'.$this->getObject()- > >getFotoPrincipale(), > 'is_image' => true, > 'edit_mode' => !$this->isNew(), > 'with_delete' => false, > 'template' => '%file%%input%%delete% > %delete_label%' > )); > > I've also an admin generated backend interface, but I want to delete > the photo uploaded when the record is deleted. > > How to this? Thanks for help me... > > -- > > You received this message because you are subscribed to the Google Groups > "symfony users" group. > To post to this group, send email to symfony-us...@googlegroups.com. > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.