Monday, 6 September 2010

Uploading pdf's with CodeIgniter

Small tip for anyone tearing their few remaining strands of greying hair out while trying to persuade CodeIgniter (currently version 1.7.2) to upload pdf files.

The problem seems to be that the Mime definitions in application/config/mimes.php are hideously limited for "pdf".

Look for the line

‘pdf’   =>      array(‘application/pdf’, ‘application/x-pdf’)


I changed this to

array('application/pdf', 'application/x-pdf', 'application/x-download','application/x-download', 'binary/octet-stream', 'application/unknown', 'application/force-download', 'application/octetstream')

I'm sure there's a million other variations on a theme but this at least got me started with open office 3 (mac version) pdf exports.