On Dec 1, 2007 4:54 PM, wilson <[EMAIL PROTECTED]> wrote: > > Hiya, > > I've got a simple image upload form in which the user can come back > and update the image, as well as name, description etc. > > The issue I'm having is that when they come back to only update the > description, I don't want the original image to be overridden. > > So I first thought that I could just unset the array item. For > example: > > if (!$this->data['Home']['image']['name']) { > unset($this->data['Home']['image']); > } > > However, the Cake save() function still overrwrites the old image in > the DB. > > How do you all accomplish this in your forms? Is there a CakePHP > syntax to tell it to not update a field?
Try putting the code that unsets that element in the array in a beforeSave() method in the model. -- Chris Hartjes My motto for 2007: "Just build it, damnit!" @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---