[Catalyst] restore session manually

Charlie Garrison garrison at zeta.org.au
Sat Jul 3 00:30:42 GMT 2010


Good morning,

On 2/07/10 at 10:30 AM +0200, Bernhard Bauch <bauch at zsi.at> wrote:

>i'm trying to use this super nice jquery file uploader with 
>progress bar (http://www.uploadify.com/).

>[...]

>the problem is i did not manage to restore the session from the session-id manually.
>i did try to call some of the functions of Plugin::Session manually, but it did not work out.

Use Session::State::URI, eg.

   use Catalyst qw/ ....
     Session
     Session::Store::FastMmap
     Session::State::Cookie
     Session::State::URI


And in your javascript, tell uploadify which session_id to use:

     $('#uploadify').uploadify({
         ....
         'scriptData'  : {'session.id': '[% c.sessionid %]' },
         ...

Note, I generate the javascript in my template file, so the 
session_id becomes hard-coded in each page. You could also read 
the current cookie session and pass that in instead.

Also, I did that code ages ago, there could be some other config 
data elsewhere that I'm not remembering. Eg. I'm not sure why 
the scriptData is using session.id rather than session_id.

I also seem to recall having to put in an exception somewhere 
for my upload action, again don't recall what that way. If you 
get stuck let me know and I'll dig through my code some more.

Charlie

-- 
    Ꮚ Charlie Garrison ♊ <garrison at zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt



More information about the Catalyst mailing list