Welcome Guest, Not a member yet? Register   Sign In
Help! Keep getting an error when uploading files.
#1

[eluser]dangermark[/eluser]
Hi guys, I hope I can get some help with this. I've done this many times before with no problems, but for some reason this is giving me grief.

I am getting the error: The filetype you are attempting to upload is not allowed when I try to uplaod any file.

Code:
if(!empty($_FILES['proof_of_purchase']['name'])) {
    $config['upload_path'] = './uploads/invoices/';
    $config['allowed_types'] = 'gif|jpg|jpeg|png|pdf|bmp';
    $config['max_size'] = '3000';
    $this->load->library('upload', $config);

      // if there was an error, return and display it
    if (!$this->upload->do_upload('proof_of_purchase'))
    {
        $data['error'] = $this->upload->display_errors();
        $data['include'] = 'pages/classic-register';
    } else {
        $data['upload_data'] = $this->upload->data();
        $filename = $data['upload_data']['file_name'];
    }
}

I have tried many different files- mostly gif & jpeg and get the same error each time.

var_dump($_FILES); gives me:

Code:
array(1) { ["proof_of_purchase"]=> array(5) { ["name"]=> string(28) "2010-12-04_00019.jpg" ["type"]=> string(10) "image/jpeg" ["tmp_name"]=> string(19) "D:\temp\php2BAE.tmp" ["error"]=> int(0) ["size"]=> int(58054) } }

I have checked the mime config and it contains the right stuff. Example:
Quote:'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),

Dumping out the upload data gives me:

Quote:array(14) { ["file_name"]=> string(15) "2010-12-04_00019.jpg" ["file_type"]=> string(10) "image/jpeg" ["file_path"]=> string(32) "D:/www/website/uploads/invoices/" ["full_path"]=> string(47) "D:/www/website/uploads/invoices/2010-12-04_00019.jpg" ["raw_name"]=> string(11) "2010-12-04_00019" ["orig_name"]=> string(0) "" ["client_name"]=> string(15) "2010-12-04_00019.jpg" ["file_ext"]=> string(4) ".jpg" ["file_size"]=> int(18168) ["is_image"]=> bool(true) ["image_width"]=> string(0) "" ["image_height"]=> string(0) "" ["image_type"]=> string(0) "" ["image_size_str"]=> string(0) "" }

This is driving me nuts! I can't see anything wrong with this, and i've even done uploading in the same project with no problems. Can someone please help?




Theme © iAndrew 2016 - Forum software by © MyBB