I'm using Flash uploader(uploadify, swfupload) with CodeIgniter, want to get the session data. I have found out that the flash does not send the session data, so I have set $config['sess_match_useragent'] = FALSE;
Now for example i have set session value myname
in session and I can get it on my backend PHP script using Internet Explorer. :
Array
(
[session_id] => f4l82aa3f82rd4b2ed682e0e132d7a72
[ip_address] => 127.0.0.1
[user_agent] => Shockwave Flash
[last_activity] => 1310546544
[myname] => test
)
But the problem is that it works fine ONLY on Internet Explorer. On Internet Explorer, the session_id
remains same before and after using flash.
But on the Firefox and all other browsers, the session_id
is Changed and I can get only session_id, ip_address, user_agent, last_activity BUT not myname
.
Array
(
[session_id] => c2cafff6daadc5148e6646s8c4c2aafa
[ip_address] => 127.0.0.1
[user_agent] => Shockwave Flash
[last_activity] => 1310548338
)
By browsing and asking the previous questions on SO, I found out that since the Flash deletes the session data, I should send the current Session ID to the backend script and then restore the session using that session ID. So I am setting the session_id using original session ID.
$original_session_id = $_REQUEST['session_id'];
$newdata = array(
'session_id' => $original_session_id,
);
$this->session->set_userdata($newdata);
Now I can see that the session ID is set successully and it is same as previous, but the problem is that I still can not get the other session data, such as myname
. Why is that so? Shouldnt I get it because now my session_id
is same. Where does the session data goes and how can I retrieve it now?
You could reopen the session using session_id()
as follows...
session_id($original_session_id);
session_start();
$this->session->set_userdata($_SESSION);