Search code examples
phpsessioncakephpuploaduploadify

CakePHP: Session is lost after calling an action from a plugin


I have a plugin for uploading files using jquery uploadify. After calling a method from this plugin the session is lost. I'm no longer logged in.

Is there a way to make all the pages from this plugin public? What can cause this behavior?

Thanks.


Solution

  • You need to preserve your session, pass your session ID over with the uploadify POST data.

    Once you have sent that over, reinitiate the session using:

    $this->Session->id( $this->data['Model']['phpsessid'] );
    $this->Session->start();
    

    In your beforeFilter();

    This will cause your session to pick back up. The reason it broke, is because Flash is an entirely different user agent.