Welcome Guest, Not a member yet? Register   Sign In
[Workaround found] CodeIgniter 3.0 cannot access native $_SESSION
#13

(This post was last modified: 07-02-2015, 12:32 PM by rodyoukai.)

I solved using a snippet, it works for me when combine kcfinder!!!


EXAMPLE


In my View (using a JQuery Function):

PHP Code:
$.ajax({
 
   
        url 
'<?=base_url();?>' 'public/snippets/set_kcfinder.php',
 
    
        
        data 
: { uploadURL '<?=base_url()."public/upload/".$seccion;?>',
 
               file_delete true,
 
               file_upload true,
 
               dir_delete true,
 
               dir_rename true,
 
               dir_create true
            
},
 
    
        
        type 
'POST',
 
    
         success 
: function() {
 
           alert('salio chido');
 
       },
 
       
        error 
: function() {
 
           alert('Disculpe, existió un problema');
 
       },
 
    
        
    
}); 

In my Snippet:

PHP Code:
<?
session_start();

unset($_SESSION['KCFINDER']);

    if (array_key_exists('uploadURL', $_POST)) {
        
        $_SESSION['KCFINDER']['uploadURL'] = $_POST['uploadURL'];
    
    }

    if (array_key_exists('folder', $_POST)) {

        $_SESSION['KCFINDER']['types'][$_POST['folder']] = "";
        
    }

    if (array_key_exists('file_rename', $_POST)) {

        $_SESSION['KCFINDER']['access']['files']['rename'] = $_POST['file_rename'];
        
    }

    if (array_key_exists('file_delete', $_POST)) {

        $_SESSION['KCFINDER']['access']['files']['delete'] = $_POST['file_delete'];
        
    }

    if (array_key_exists('file_upload', $_POST)) {    

        $_SESSION['KCFINDER']['access']['files']['upload'] = true;
        
    }

        
    if (array_key_exists('dir_delete', $_POST)) {
        $_SESSION['KCFINDER']['access']['dirs']['delete'] = true;
        
    }

    
    if (array_key_exists('dir_rename', $_POST)) {
        $_SESSION['KCFINDER']['access']['dirs']['rename'] = true;
        
    }

    if (array_key_exists('dir_create', $_POST)) {

           $_SESSION['KCFINDER']['access']['dirs']['create'] = true;


    }
?>

I apologize for my limited and ugly English 
Reply


Messages In This Thread
RE: [Workaround found] CodeIgniter 3.0 cannot access native $_SESSION - by rodyoukai - 07-02-2015, 12:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB