Wednesday, April 3, 2013

Session in Behavior

Hi
I am using cake 1.3 and Bauth component to write logged in user id to
session.

The problem:
I am trying to upload images to a path based on the user id.
I am using Jose Diaz-Gonzalez's upload plugin
https://github.com/josegonzalez/upload/tree/1.3 .

In the Behavior "upload.php" I need to configure the path
$this->defaults['path'] =
'{ROOT}webroot{DS}img{DS}useruploads{DS}images{DS}';
to something like
$this->defaults['path'] = '{ROOT}webroot{DS}img{DS}' .$id. '{DS}images{DS}';
using the user id stored in the session

I have tried to read the session $session->read("Userinfo.id"); but it does
not seem to work. also tried to check $_SESSION data but get a undefined
variable error.

is there a solution to write this path with the user's $id ??
I have tried a few ways to get session into a model but I really dont
understand enough to figure it out :(

Thanks
Robert






--
View this message in context: http://cakephp.1045679.n5.nabble.com/Session-in-Behavior-tp5714402.html
Sent from the CakePHP mailing list archive at Nabble.com.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: