Can't access $_SESSION variable in PHP called from Flash
I'm having difficulty accessing a $_SESSION
variable.
I have session_start开发者_开发问答()
at the beginning of the file.
I'm using jQuery uploadify and it calls a php backend file, which can't access $_SESSION
variables, although other files outside could.
Could it have something to do with the way that flash (jquery uploadify) is calling the php?
Does anyone know how to circumvent this?
UPDATE: included session_id in the url but it didnt work.
$('#image_upload').uploadify({
'uploader': '../../frontend/jquery/plugins/uploadify/swf/uploadify.swf',
'script': "controllers/image_upload.php?SID='.session_id()'",
'fileDataName': 'upload',
'method': 'POST',
'multi': 'true',
'fileDesc': 'tseting',
'fileExt': '*.jpg; *.jpeg; *.png',
'sizeLimit': '100000000',
'buttonText': 'Ladda upp bilder',
'auto': 'true'
});
EDIT: i think i know what the problem is.
in the header information with livehtmlheader in FF it shows an error message:
HTTP/1.x 404 Not Found
while the other regular page requests shows
HTTP/1.x 200 OK
someone knows how to solve this?
EDIT: sorry i've had wrong. it was not cause by 404, that was a request to another file. there is NO request when posting with uploadify! no html header is sent. i think it uses another approach to get the php file with flash (uploadify.swf).
so there is no way of sending that sessid to my php file now i guess:( have to find some other way around
In certain browsers (firefox iirc) "special" calls, such as file uploads and amf do not always send along the session cookie. The most practical way to sidestep this is to set it as a flashvar when embedding the flash and manually send it along with your request.
http://www.uploadify.com/forums/discussion/606/io-error-php-session/p1
Try adding manually "?SID=".session_id() to the URL.
精彩评论