Wednesday, May 4, 2011

David Persson's Media Plugin

Hello Folks,

I'm working on my first project with cakephp and I ran into an issue
when trying to
implement file uploads:

1) I'm trying to use the media plugin for my application. I'm having
problems to apply
the polymorphic behavior to the model. Here are my models and the
controller:

models/attachment.php: http://pastie.org/private/qjofpjluwaxsgr4t99jw
models/artist.php
: http://pastie.org/private/oqhz5isx4npxdo1b0olvew
controllers/artists_contoller.php
: http://pastie.org/private/x1u10dbgc9awwpxhulqcw

When I upload a new file, its saved correctly into the attachments
table, but without
the foreign_key or the model fields being set.

2) I tried as well to manually add this fields by extending $this-
>data in my controller,
but I end up with a broken string in my database.

Here is the controller with the manually specified model and
foreign_key:

http://pastie.org/private/wrgxo9sdspar3sdxgrpyyq

and the field if its read by the Artist view:

http://666kb.com/i/bt7evphoib2ca2m6y.gif


Regards, Stefan.

--
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: