Monday, February 21, 2011

Re: Media Plugin - Newbie Questions

I don't know anything about the Media plugin, however your problem may
be with how you have created your inputs in the view. Have you looked
at the structure of $this->data once the form has been submitted to
your action (admin_add)? In order for saveAll() to work. It should
look something like:

array(
[PressRelease]=>array(
[date]=>// some date
. // other fields
.
[Attachment]=>array(
[file]=>// some file name

In your view you have:
echo $this->Form->input('file', array('label' => 'File', 'type'
=>'file'));

It may be as simple as changing this to:
echo $this->Form->input('Attachment.file', array('label' => 'File',
'type' =>'file'));

BTW, saveAll() will save related model data ONLY if the array passed
is properly structured AND it is only one level deep.

HTH,
Ken

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: