0

The following function keeps telling me that I have uploaded the wrong filetype even though I am definately uploading a PDF file - can anyone suggest what is going wrong?

// output of the var_dump's
$this->upload->data() (array)
file_name   brochure.pdf
file_type   [empty string]
file_path   D:/Shared/Web Sites/site-dev/documents/
full_path   D:/Shared/Web Sites/site-dev/documents/brochure.pdf
raw_name    brochure
orig_name   [empty string]
client_name brochure.pdf
file_ext    .pdf
file_size   369498
is_image    FALSE
image_width [empty string]
image_height    [empty string]
image_type  [empty string]
image_size_str  [empty string]

$data (array)
error   

The filetype you are attempting to upload is not allowed.

function do_upload()
{
    $config['upload_path'] = './documents/';
    $config['allowed_types'] = 'pdf|doc';

    $this->load->library('upload', $config);

    if ( ! $this->upload->do_upload('File'))
    {
        $data = array('error' => $this->upload->display_errors());
                    var_dump($this->upload->data());
                    var_dump($data);exit;
        //$this->load->view('upload_form', $error);
    }
    else
    {
        $data = array('upload_data' => $this->upload->data());

        //$this->load->view('upload_success', $data);
    }

    return $data;
} 
Broncha
  • 3,794
  • 1
  • 24
  • 34
Zabs
  • 13,852
  • 45
  • 173
  • 297
  • 1
    Can you plese try `dump($this->upload->file_type);` – safarov Mar 30 '12 at 09:55
  • Fixed - there is a problem with the Upload class in 2.1 I followed the instructions on here with modifying the Upload library and all worked :) Thanks for the quick response :) http://stackoverflow.com/questions/7495407/uploading-in-codeigniter-the-filetype-you-are-attempting-to-upload-is-not-allo – Zabs Mar 30 '12 at 10:00

1 Answers1

0

Fixed - problem with 2.1 (see my post above)

Zabs
  • 13,852
  • 45
  • 173
  • 297