> However, when i click edit it will only populate the input
> fields not the file field, and if i update it like that it creates a
> new entry and leaves the file field null.  Is there something I am
> missing?

File fields cannot be pre-populated as a security measure so files
don't get accidently uploaded (you could theoretically load a path to
a file that the user doesn't want to share and if they submit the form
you suddenly have data they didn't want to give you).

Also you might want to optimize this bit of code to only hit the
database once:

> $this->Pic->id = $id;
> $this->set('pic', $this->Pic->read());
> $this->data = $this->Pic->read();

I'm not sure why you need the same data in your view as $pic and $this-
>data, so you can probably do without the $pic set. If you're using
the formHelper you just need it in $this->data to have everything pre-
populated.  And you can do without setting the ID by just using one of
the other Model methods.

Such as: $this->Pic->find(array('id'=>$id));

Or the magic method way, $this->Pic->FindById($id);

Or probably what I would do is to define a method in PicModel to
lookup by ID and show an error if the ID was invalid. That way you
can't try and edit a record that doesn't exist.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to