• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dx and flash uploader ie 6-7-8 issues

#1
[eluser]bugboy[/eluser]
Hi all.

I've run into an issue.

I've got dx_auth ruuning on my site and have got a uploadify running as a flash uploader.

I've modified dx to allow for flash uploading and it works in every browser apart from the IE family.

For some reason after the file has been uploaded it logs the user out.
I cant see why it would with a simple javascript redirect and why its just the IE family doing it.

I'm stumped as my added piece of code wouldn't log a user out.

added this to dx auth (library)
Code:
/* flash upload checking function */
    function check_flash($session_id=NULL)
    {
        // load user model
        $this->ci->load->model('permissions', 'permissions', FALSE, 'user');
        if($session_id != NULL)
        {
            // check session value against database
            $data = $this->ci->permissions->check_session_live($session_id);
            if(!empty($data))
            {
                // ok data is found but is it valid
                if($data['DX_logged_in'] == 1)
                {
                    return TRUE;
                }
                else
                {
                    return FALSE;
                }
            }
            else
            {
            return FALSE;
            }
        }
        return FALSE;
    }

the actual upload part (controller)
Code:
function do_upload()
    {
        if($this->uri->segment(4))
        {
            if($this->dx_auth->check_flash($this->uri->segment(4)))
            {
                // whoop all is ok the user session is logged in                
                $config['upload_path'] = $this->uploads_folder;
                $config['allowed_types'] = $this->allowed_file_types;
                $this->load->library('upload', $config);
                if ( ! $this->upload->do_upload())
                {
                    echo $this->upload->display_errors();
                }    
                else
                {
                    $file = $this->upload->data();
                    $data = array (
                        'type' => $file['file_type'],
                        'file' => $file['file_name'],
                        'raw' => $file['raw_name'],  
                        'file_ext' => strtolower($file['file_ext'])
                    );
                    $config['image_library'] = 'gd2';
                    $config['source_image']    = $this->uploads_folder.$file['file_name'];
                    $config['new_image'] = $this->uploads_folder.'thumb_'.$file['file_name'];
                    $config['maintain_ratio'] = TRUE;
                    $config['width'] = 75;
                    $config['height'] = 50;
                    $this->load->library('image_lib', $config);
                    if($this->image_lib->resize())
                    {
                        $data['image'] = 1;    
                    }
                    $this->media_model->update($data);
                    echo 'Successfully uploaded '.$file['file_name'];            
                }
            }
            else
            {
                // user is no longer using this session sorry go away
                $this->output->set_status_header('404');
            }
        }
        else
        {
            $this->output->set_status_header('404');
        }
    }


the javascript (view)
Code:
[removed]
        $(document).ready(function(){    
    
            $('#userfile').fileUpload({
            'uploader':'http://temporary.twelve20design.com/assets/flash/uploader.swf',
            'script':'/media/backend/do_upload/d66a11d13d531fffda37722d427cd077',
            'cancelImg':'http://temporary.twelve20design.com/assets/images/cancel.png',
            'fileDataName':'userfile',
            'width':'120',
            'height':'30',
            onComplete: function (evt, queueID, fileObj, response, data) {
                alert(response);
                [removed] = "/media/backend"
            }
            });

        });

        [removed]




<fieldset>

<legend>Upload Media</legend>

<p>
    <label for="userfile">Select File to Upload</label>
    &lt;input type="file" id="userfile" name="userfile" /&gt;
</p>

<p>
    <label for="submit">Upload selected file</label>
    <button id="upload" name="submit" value="submit" type="submit">Upload Files</button>
</p>

</fieldset>

#2
[eluser]bugboy[/eluser]
Ok solved

There was an answer on the forum but once again its what you search for that give you the answers.

I found the solution thanks to this post: http://ellislab.com/forums/viewthread/115220/

Just needed to set $config[‘sess_match_useragent’]= FALSE;

and just to be cheeky i copied and pasted the above from another post.

Wicked i love CI and its forum.

Cheers guys


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.