Hi,
Suppose this is image field
<?php echo $this->Form->input('MyModel.image',array('type'=>'file')); ?>
In edit action just check,if you upload any photo or not
if(empty($this->data['MyModel']['image']['name']))
{
unset($this->data['MyModel']['image']);
$this->data['MyModel']['image']='old_field_value(old image name saved in
database)';
}
else
{
//logic for upload new file and replace the old one
}
Try this , i think it will help you.
Thanks
Timir Maji
On Fri, Apr 15, 2011 at 7:21 PM, Juliano Bordignon <[email protected]>wrote:
> hello
>
> i have a strange problem when i save the form in one of my actions..
>
> the file input try to save a array in ther the db collumm
>
> so, the debbugee display this error
>
> SQL Error: 1054: Unknown column 'Array' in 'field list'
>
> this does not happen in the "add action" because there I use the class
> verot, but here comes my doubt ..
>
> if one wants to edit the post without sending a new picture .. how can
> I do this
>
> thanks.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php