1 Reply Latest reply on Oct 26, 2007 3:51 PM by abeall

    FileReference  .upload() php Sessions not accessable

    Kory75
      After using FileReference
      .upload("myscript.php")

      the php handling the uploaded files perfectly.
      however I'm not able to reach any session variable in php
      what is very annoying.

      I have an another php call in the same swf
      what call an another php using URLLoader .load(function)
      there this problem is not happening.
      if anybody has any solution, please let me know.

      Thanks,

      Kory
        • 1. FileReference  .upload() php Sessions not accessable
          abeall Level 3
          Yes, FileReference.load fails to send browser cookie information, so PHP is unable to access a session in the script.

          The solution is manually send the cookie in the url as a querystring, ie FileReference.upload("myscript.php?sessid="+mySessionId);

          Then manually start the PHP session based on the passed session id.

          You can retrieve the PHP session id by getting the javascript cookie via ExternalInterface.call('function(){return document.cookie;}') and parse for the returned cookie string for PHPSESSID, or you could embed the PHP session id (use the php function session_id() ) using FlashVars.

          Once you have the session id and you send it along in the querystring, you can manually start the PHP session on the server:

          if($_GET['sessid']){
          session_id($_GET['sessid']);
          }

          session_start();