Welcome Guest, Not a member yet? Register   Sign In
flash upload and CI sessions
#1

[eluser]Dregond Rahl[/eluser]
Okie iv been fighting with CI for quite a while now, I looked around for some solutions but nothing for CI sessions in specific. So im trying to upload files based on who is logged in, but it just won't do it. I even set the sessions to ignore if the user agent is the same.

Code:
function flash_upload()
    {
        $data['title'] = 'ExtremeData | Multi Upload';
        
        $data['page'] = 'upload/flash_upload';
        
        
        $config['upload_path'] = './hosted/';
        
        $config['file_rename'] = $this->input->post('fileid');
        
        $config['allowed_types'] = 'png|gif|jpg|jpeg|bmp|tif|ico|pspimage|psd|pdf|txt|zip|rar|tga|abr|css|js';
        
        $config['max_size']    = '2048';
        

        $this->load->library('upload', $config);

        if ($_FILES)
        {
            if ($this->upload->do_upload('flashup'))
            {
                $uploads = $this->Upload_model->create_thumb();
                
                $this->Upload_model->save_file(user_name(), $uploads);
            }
        }
        else
        {
            $this->load->view('index', $data);
        }
    }

Its nothing fancy coding wise, just need help transferring, what ever i need to transfer to make it work right.



Cookies:

logged_in
ci_session


I really have no idea, my best guess is i have to use "get" to send the "logged_in" value thru the url and do a DB check and retrieve the user_name field.
#2

[eluser]Evil Wizard[/eluser]
May I assume that when the user logs in a value is set somewhere to prevent the user being faced with the login screen at every page lol. What I do is set the session value on successful login
Code:
if(successful_login($user, $pass)) {
    $this->session->set_userdata('logged_in', 'true');
}
then a quick check every time you need to be sure of the login
Code:
if($this->session->userdata('logged_in') === 'true') {
    // user is logged in do stuff
} else {
    // not logged in, redirect somewhere
}
Just remember to unset/destroy the session variable when the user logs out.
#3

[eluser]Dregond Rahl[/eluser]
flash cant read CI sessions so it doesn't work when it uploads, the sessions are blank for it. =/




Theme © iAndrew 2016 - Forum software by © MyBB