[symfony-users] Re: How to delete uploaded images when deleting records

2009-12-28 Thread ilcaduceo
I have another problem, when i update the record, then the old photo
isn't deleted itself, but it remain in the filesystem. How can i
delete the old photo or replace it with the new photo?

I try:

public function postUpdate($event) {

@unlink(sfConfig::get('sf_upload_dir').'/immobili/original/'.$this-
>fotoPrincipale);
@unlink(sfConfig::get('sf_upload_dir').'/immobili/big/'.$this-
>fotoPrincipale);

@unlink(sfConfig::get('sf_upload_dir').'/immobili/thumbnail/'.$this-
>fotoPrincipale);
}

but I think that $this->fotoPrincipale refers to the new values, how
can i refer to the old values in the table?

Thanks to all!

On 28 Dic, 12:28, ilcaduceo  wrote:
> I try the code and it's correct! I understand that this method is in
> the Doctrine documentation, and also I found other useful methods...
> Thanks!
>
> On 24 Dic, 22:15, ilcaduceo  wrote:
>
> > Yes i'm storing file paths in the database and the photos in the
> > filesystem... I'm using Doctrine but i don't find any information
> > about postDelete method in the documentation, however I try this
> > code... Happy Holydays!
>
> > On 24 Dic, 12:52, Alexandru-Emil Lupu  wrote:
>
> > > 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.




[symfony-users] Re: How to delete uploaded images when deleting records

2009-12-28 Thread ilcaduceo
I try the code and it's correct! I understand that this method is in
the Doctrine documentation, and also I found other useful methods...
Thanks!

On 24 Dic, 22:15, ilcaduceo  wrote:
> Yes i'm storing file paths in the database and the photos in the
> filesystem... I'm using Doctrine but i don't find any information
> about postDelete method in the documentation, however I try this
> code... Happy Holydays!
>
> On 24 Dic, 12:52, Alexandru-Emil Lupu  wrote:
>
> > 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.




[symfony-users] Re: How to delete uploaded images when deleting records

2009-12-24 Thread ilcaduceo
Yes i'm storing file paths in the database and the photos in the
filesystem... I'm using Doctrine but i don't find any information
about postDelete method in the documentation, however I try this
code... Happy Holydays!

On 24 Dic, 12:52, Alexandru-Emil Lupu  wrote:
> 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.