Welcome Guest, Not a member yet? Register   Sign In
Bug in File Upload Class?
#1

I'm trying to upload a file and overwrite if exists on server but I always get error msg like:
"File exists, overwrite is FALSE, could not save over file ./uploads/avatars/1.jpg"

Here is my code where 'overwrite' is TRUE... Any idea how to solve this?

Code:
if( isset($_FILES['userfile']['name']) ) {
    if( $_FILES['userfile']['name'] != "") {
        $config['upload_path'] = 'uploads/avatars/temp/';
        $config['allowed_types'] = 'gif|jpg|png|jpeg';
        $config['remove_spaces'] = true;
        $config['overwrite'] = true;
        $config['encrypt_name'] = true;
        $config['max_size'] = '3000';
        $config['max_width']  = '3000';
        $config['max_height']  = '3000';
        $this->load->library('upload', $config);

        if (!$this->upload->do_upload('userfile')) {
            // Failed
            $error = array('error' => $this->upload->display_errors());
            print_r($error);
            exit();
        } else {
            // Success
            $image = $this->upload->data();
            var_dump( $image );
        }
    }
}
Reply


Messages In This Thread
Bug in File Upload Class? - by Stefan57 - 12-09-2014, 06:33 AM
RE: Bug in File Upload Class? - by Avenirer - 12-09-2014, 07:42 AM
RE: Bug in File Upload Class? - by Stefan57 - 12-09-2014, 08:03 AM
RE: Bug in File Upload Class? - by Stefan57 - 12-09-2014, 08:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB