Are you renaming the uploaded file based off your Model ID?
On Apr 30, 12:09 pm, avairet <[EMAIL PROTECTED]> wrote:
> @clark :
>
> >>> I'm assuming you do the move uploaded file in the afterSave() to use the
> >>> Model ID in the filename?
>
> YES, exactly, because if the move_upload fails I would like to delete
> my record!
>
> >>> move the uploaded file beforeSave() so you can invalidate() if necessary,
> >>> and then do a file rename in the afterSave()
>
> Ok, why not... but I think it's easier to make a sql delete instead of
> a file rename or file unlink
>
> On 30 avr, 18:02, avairet <[EMAIL PROTECTED]> wrote:
>
> > Ok, ok, ok guys, don't stress with my stupid questions ;o))
>
> > So, how can I return a value to my controller after my save logic?
> > Must I do my move_uploaded_file in the Controller?
>
> > On 30 avr, 17:59, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
>
> > > On Wed, Apr 30, 2008 at 11:53 AM, avairet <[EMAIL PROTECTED]> wrote:
>
> > > > In fact, in my Model::afterSave, I do a "move_uploaded_file()" and if
> > > > this move doesn't work, I would like to redirect in the previous
> > > > controller action instead of the redirect(index)
>
> > > You cannot redirect from inside a model, like Clark said. You must
> > > get your model to return some value to the controller that you can use
> > > to determine if you need to redirect or not.
>
> > > Again, this comes with understanding both Cake's conventions and
> > > understanding how Cake's MVC implementation works.
>
> > > --
> > > Chris Hartjes
> > > Internet Loudmouth
> > > Motto for 2008: "Moving from herding elephants to handling snakes..."
> > > @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---