Welcome Guest, Not a member yet? Register   Sign In
Yet another .zip file uploading issue

I searched the forums and tried a few fixes but still can't get my upload function to accept a zip file. Error: Filetype not allowed. Other files listed in the config work fine. Here is my code. Thanks in advance for your time!

public function upload_files()
        //check access
        $access = $this->_check_auth_admin();
    if ($access != 1)
    $type = $this->input->post('type');
    //config for file upload class
    $config['upload_path'] = './partner_assets/' . $type;
    $config['allowed_types'] = 'jpg|png|eps|pdf|doc|xls|ppt|txt|ai|psd|zip';
    $config['max_size'] = '0';
    //load additional libraries
    $this->load->library('upload', $config);
        //set title
        $this->data['title'] = "Materials Upload";
        //get navigation
        $this->data['sections'] = $this->navigator->get_navigator_sections($access);
    //set options for form elements
    $this->data['form_options'] = array(
    'id' => 'upload_form'
    $this->data['name_options'] = array(
    'id' => 'name',
    'name' => 'name',
    'size' => '46',
    'maxlength' => '50'
    $this->data['description_options'] = array(
    'id' => 'description',
    'name' => 'description',
    'rows' => '3',
    'columns' => '25',
    'maxlength' => '100'
    $this->data['type_options'] = array(
    'slicks' => 'Slicks',
    'logos'  => 'Logos',
    'manuals' => 'Manuals',
    'documents' => 'Documents'
    $this->data['usage_options'] = array(
    'web/screen' => 'Web/Screen',
    'print'  => 'Print',
    $this->data['active_options'] = array(
    '1' => 'Yes',
    '0' => 'No',
    if ( ! $this->upload->do_upload())
    $this->data['message'] = $this->upload->display_errors();
    //generate view
    $this->load->view('templates/header', $this->data);
    $this->load->view('templates/sections', $this->data);
    $this->load->view('materials/upload_files', $this->data);
    //set upload data
    $file = $this->upload->data();
    $material_object = new stdClass;
    $material_object->name = $this->input->post('name');
    $material_object->description = $this->input->post('description');
    $material_object->type = $this->input->post('type');
    $material_object->thumbnail = '';
    $material_object->file = url_title($file['file_name'], 'underscore', TRUE);
    $material_object->usage = $this->input->post('usage');
    $material_object->active = $this->input->post('active');
    if ( ! $this->materials_model->add_materials_data($material_object))
    redirect('materials/upload_files', 'refresh');
    //set messages
    $this->session->set_flashdata('message', "You did a great job uploading that file!");
    redirect('materials/index', 'refresh');


Array ( [userfile] => Array ( [name] => exx_ptr_logo_pkg.zip [type] => application/zip [tmp_name] => /var/tmp/phpys3tpQ [error] => 0 [size] => 196512 ) )

'zip' =>  array('application/zip', 'application/x-zip', 'application/x-zip-compressed', 'application/octet-stream', 'application/x-compress', 'application/x-compressed', 'multipart/x-zip'),


did you add this file type in your configuration file, $config['allowed_types'] ??

Yeah. See line 18ish towards the top of the posted controller code.

Just an update:

I was unable to get the file uploading class to let me specify individual file types separated by a pipe. It would upload a jpg but not any of the other file types. I tried just using a single file type as well. For example $config['allowed_types'] = 'png';. But no luck. It wouldn't let me upload the file. This is strange as I've been able to make this work before.


I just allowed all file types with '*' and it works fine. I realize this is not ideal for a public facing page but since the upload page is for administrators who are logged in and that admin is me and a few other people I think it'll be ok.

If anyone can point me in the right direction as to what I'm doing wrong I'd appreciate it. And yes, I have read the manual. Smile


Theme © iAndrew 2016 - Forum software by © MyBB