0
votes

I have a CI project running 2.1.4 and am attempting to upload .pdf files.

I know this question is asked elsewhere but I have not seen anyone identify the below details and attempted corrections only to have the issue unresolved.

Main objective: add ability to upload pdf files though codeigniter do_upload function

After scouring for solutions elsewhere I have attempted to update my mime.config file without success.

var_dump($this->upload->data()) provides the following output:

array(14) { ["file_name"]=> string(14) "AL14052701.pdf" ["file_type"]=> string(15) "application/pdf" ["file_path"]=> string(31) "/var/www/Inspection/Attachment/" ["full_path"]=> string(45) "/var/www/Inspection/Attachment/AL14052701.pdf" ["raw_name"]=> string(10) "AL14052701" ["orig_name"]=> string(0) "" ["client_name"]=> string(14) "AL14052701.pdf" ["file_ext"]=> string(4) ".pdf" ["file_size"]=> float(313.54) ["is_image"]=> bool(false) ["image_width"]=> string(0) "" ["image_height"]=> string(0) "" ["image_type"]=> string(0) "" ["image_size_str"]=> string(0) "" }

I then checked my mimes.php file and confirmed type pdf included the "application/pdf" type as indicated in the "file_type" variable. . . which it does:

'pdf' => array('application/pdf', 'application/x-download'),

Allowed types in the controller:

$config['allowed_types'] = 'zip|doc|docx|xls|xlsx|ppt|pptx|csv|ods|odt|odp|pdf|rtf|txt|avi|mpeg|mp3|mp4|3gp|gif|jpg|jpeg|png';

php version

5.3.2-1

I had a similar issue getting ods and odt files to upload but was able to remedy this via the mimes.php file. I've also looked at my Upload.php

I can upload pdf files to the same server when not using codeigniter and am able to upload other file types (.doc, .xls, .odt, .ods, .txt are the types I've tried). what am I missing?

1

1 Answers

0
votes

Unbelievable... sometimes you can't see the forest through the trees... the issue was file size, not file type.