I'm currently experiencing the same issue, and have begun digging into
the plugin code to see if there is a way to extend the plugin to
support multiple instances of the same behavior. I'll tell you a
little bit about the problem I'm trying to solve, so that you may have
a better understanding of the actions I take to solve this problem.

I'm in the process of building a simple content management system for
our company website. The files uploaded for unauthenticated users
should be stored in the /app/webroot/files directory so that they are
publicly accessible. Files uploaded for authenticated users are
accessed through a controller using a download() function that sends
the file using the MediaView. This way we can move the files to a
private directory under /app/ and use our authentication component to
control who can download what. I have set two different configurations
for the respective models, but everything is being uploaded to the
same directory, same as you.

I'm by no means a CakePHP expert, but what I'm thinking is extending
the FileUpload behavior into two new behaviors, one for public uploads
and one for private uploads. I don't know if it will work or how it
fits cake convention, so I'm open to comments/suggestions...


On Sep 22, 12:05 am, Wanna be baker <[email protected]> wrote:
> I have a Shirt which has many different images
> - shirt_image
> - thumb_on_image
> - thumb_off_image
> - price_banner_image
>
> The files get stored in separate places (or are supposed to be).  What
> I've found (using a model like what is show here:http://pastebin.com/gbnLpxN0)
> is that the value of uploadDir gets overwritten.  Net, the last
> declaration of it affects all of the other executions.  Couple this
> with the fact that I can't figure out how to get DS into the uploadDir
> declaration, has caused me some good sized headaches.
>
> At the moment, with the constructor call commented out and the .{DS}.
> in the actsAs, this blows up...  but it does work if I use  the
> constructor method; it's just that the files get stored in the wrong
> spots...
>
> The variable issue lead me to try using the constructor to affect that
> option.  However, even that has the same issues with the value being
> overridden.
>
> As a result, I have two questions...  One specific and one high level.
>
> Specific: how can I get this declaration of uploadDir set correctly so
> that different models can have different uploadDirs?
>
> High-level: How does this get instantiated (this plugin)?  Does it
> instantiate one instance of the behavior at run time or does it create
> one for each model?  If it's the latter, it's not working as I would
> expect.  Also, where's a good tutorial that would help me understand
> the OO nature and instantiation order in CakePHP?
>
> Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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