I'm using uploadify, and i can't set sessions in my php files, my script looks like this:
$("#uploadify").uploadify({
'uploader' : '/extra/flash/uploadify.swf',
'script' : '/admin/uploads/artistsphotos',
'scriptData' : {'PHPSESSID' : '<?= session_id(); ?>'},
'cancelImg' : '/images/cancel.png',
'folder' : '/img/artists',
'queueID' : 'fileQueue',
'auto' : false,
'multi' : true,
'onComplete' : function(a, b, c, d, e){
},
'onAllComplete': function(event,data){
$bla = $('#art').find(':selected',this);
$fi = $bla.val();
$.ajax({
type: "POST",
url: "/admin/uploads/artistsphotosupload",
data: "artist="+$fi,
success: function(msg){
console.log(msg);
}
});
}
});
And in php if i try:
$_SESSION['name'] = 'something';
I can't access it in another file.and i have session_start(); activated Any solutions?
you cannot solve this because uploadify has own session ID which is created by flash player. In other words the flash player access the uploadify script as a new user and gets a new session. The only way you can solve this is to pass current page session_id through post to the uploadify script.
Usually the session ID won't be read from POST. You could do this:
$_COOKIE['PHPSESSID'] = $_POST['PHPSESSID'];
session_start();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With