Welcome Guest, Not a member yet? Register   Sign In
flash upload ( Flash File Uploader ) and DX Auth user auth system problem uploading behind login
#1

[eluser]bugboy[/eluser]
Hello All

I'm using two very nice codes i have found from you guys which i'm loving.

flash file uploader
http://don.citarella.net/index.php/actio...-uploader/
forum post where found
http://ellislab.com/forums/viewthread/90701/#490804

And i'm using the most recent release of DX Auth
http://ellislab.com/forums/viewthread/98465/

How ever once i place flash file upload behind DX Auth it keeps returning a 302 error however as soon as i take dx auth off it works great.

i think it has to do with the sessions and flash login but i have no idea how to get round this. Any idea or pointers into the right direction.

Controller
Code:
class New_upload extends Controller {
    /**
     * uploads constructor
     *
     * @return void
     * @author Chris Newton
     **/    
    
    function New_upload()
    {
        parent::Controller();
        log_message('debug', 'uploads Controller Initialized');
        
        $this->load->library('DX_Auth');
$this->dx_auth->check_uri_permissions();
        
        
    }
    function index()
    {

        $this->flash_upload();
    }
    /**
     * flash_upload
     *
     * @access public
     * @return void
     * @author Chris Newton
     **/
    function flash_upload()
    {        
        $data=NULL;
        $data['session_id'] = $this->session->userdata('session_id');
        $this->load->view('view_upload_form', $data);
    }
    /**
     * process_flash_upload
     *
     * an interface for _upload_file below specifically configured for uploads from flash.
     * @access public
     * @return void
     * @author Chris Newton
     **/
    function process_flash_upload()
    {
    
        // LOOKING FOR AN EXPLICIT SESS ID FROM FLASH!
        // OTHERWISE IT'LL CREATE ITS OWN, AND SCREW UP YOUR UPLOAD!!!
        if ($this->input->post('session_id'))
        {
            session_id($this->input->post('session_id'));
        }
        // for overriding flash input field name default
        if ($this->input->post('fieldname') )
        {
            $field_name=$this->input->post('fieldname');
        }
        else
        {
            // the default name for Flash upload field is Filedata
            $field_name = "Filedata";
        }

        $return_data=$this->_upload_file($field_name);
        $string="";
        foreach ($return_data as $key => $item)
        {
            // returns in query string format "success=success&error=err_message"
            $string.=$key."=".$item."&";
        }
        // remove last & character
        $string = rtrim($string, "&");
        // echos a string of data
        // Flash has to have receieve string data for the upload to complete
        // @see _upload_file below for $data returned
        echo $string;
    }
    /**
     * _upload_file
     *
     * a generic uploader, you can use this with flash or standard uploads
     *
     * @access private
     * @param string $field_name This is the name of the input field that contains the file upload data.
     * @return array returns success(failure or success) and errors(all error messages split with a | if any errors are reported)
     * @author Chris Newton
     **/
    private function _upload_file($field_name)
    {
    
        //$this->dx_auth->check_uri_permissions();
    
        $data=array();
        // 1. Using upload.php config file
        //$this->load->library('upload');

        // 2. Configuring the upload library on-the-fly
        // set your config options
        
        $config['upload_path']                    = './uploads/'; // upload path needs to have permissions set to 777 (writable)
        $config['allowed_types']                 = 'jpg';
        $config['max_size']                        = '0';
        $config['max_width']                      = '4000';
        $config['max_height']                     = '4000';
        $config['min_width']                      = '0';
        $config['min_height']                     = '0';
        $config['remove_spaces']                = TRUE;
        $config['overwrite']                    = FALSE;
        $this->load->library('upload',$config);
        
        
        
        $data['success']    = "failure";
        
        if (! $this->upload->do_upload($field_name))
        {
            $data['errors']    =    rtrim($this->upload->display_errors('','|'),"|");
            $data['success']=    'failure';
            // log_message('debug',$this->upload->display_errors('','|'));
        }
        else
        {
            /*
            $filedata                =    $this->upload->data();
            foreach ($filedata as $item)
            {
                log_message('debug', "Upload info: ". $item);
            }
            */
            $data['success']        =    'success';
            $data['filedata']        =     $this->upload->data();
        }
        return $data;
    }
    function test()
    {
        echo $this->config->item('mimes');

    }
}


Messages In This Thread
flash upload ( Flash File Uploader ) and DX Auth user auth system problem uploading behind login - by El Forum - 12-15-2008, 04:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB