Page 1 of 1

How to pass session to the post ajax request

Posted: Sun Feb 19, 2012 3:39 pm
by cve
Hi, I'm working on new module and I need upload image for category, I want to use jquery uploadify plugin so my code for display upload form inputs looks like this:

Code: Select all

$session = session_id();
$action = html_entity_decode($this->_createAjax('category_image_upload', $id, $returnid));

$this->smarty->assign('script', "
<__script__ type='text/javascript'>
$(function() { 
    $('#m1_uploadify').uploadify({
    'uploader'  : '".$this->GetModuleURLPath()."/js/uploadify/uploadify.swf',
    'script'    : '".$action."',
    'cancelImg' : '".$this->GetModuleURLPath()."/js/uploadify/cancel.png',
    'folder'    : '/uploads/shop',
    'auto'      : true,
    'onComplete'  : function(event, ID, fileObj, response, data) {
      console.log(response)
    },
    'scriptData'  : { 'PHPSESSID': '".session_id()."', '_sx_': '".$_REQUEST['_sx_']."' }
  });

})
</__script>
");
Above code works fine, but when I select file througt uploadify and plugin start upload file - in the response in firebug I have redirect to login action... It seems the cms goes log out, my question is why???

cms version: 1.10.3
kubuntu
php 5.3.6