Monthly Archives: February 2012

How to fix CodeIgniter not accepting RTF mimetype in Internet Explorer

While working with the CodeIgniter file upload library I discovered that I was able to upload RTF files in Chrome but not in Internet Explorer.

When executing:


I would get:

The filetype you are attempting to upload is not allowed



After some research I found that this was due to the fact that sometimes different web browser describe a file with the same extension with a different mime type upon upload.

Luckily the fix is simple. Internet Explorer sets the mime type of an RTF to ‘application/msword’. All we need to do is add this mime type to our mimes.php config file. CodeIgniter accepts an array of mime types per file extension, so all we need to do to fix is open up application/config/mimes.php and replace the line:

'rtf' => 'text/rtf'


rtf => array('text/rtf', 'application/msword')

You will now be able to upload RTF files in your CodeIgniter application via Internet Explorer. I hope that helps somebody!


Today I discovered the SQL function ‘COALESCE’.  The function returns the value with the highest precedence datatype from a comma separated list of expressions.  For example:

SELECT COALESCE (site_settings.value, settings.value) AS value
FROM site_settings
LEFT JOIN settings ON = site_settings.setting_id

In the above example the first non NULL value passed to the COALESCE function is selected. if site_settings.value is NULL then settings.value will be selected. If settings.value is NULL, then the site_settings.value will be selected. If both values are NULL, then NULL will be returned.

Here is the MySQL reference page for the function: COALESCE

Worth keeping in mind. Came in handy for simplifying some SQL at work.

Testing out the iPhone WordPress client: Homemade lasagne

Recipe from

Didn’t soak the pasta sheets enough so was a little dry. Other than that, yum!


I’ve decided to spend this snowy day setting up a new WordPress install for my blog.  I’ve had an idea for a project I would like to work on so rather than diving into that, I’m doing this!  I could be accused of procrastinating…

The real reason I’m re-setting up WordPress is to help me focus.  By writing down and thinking about the ideas and the resulting code I can make it the best it can be.  If it helps someone else along the way, great!  I’m likely to focus on PHP and Python as day to day thats what I’m work with.  I’m likely to plan out my project on paper over the next couple of weeks.  When I am focusing on something such as an API or a Python library I’ll use this blog to explain what I’m up to and why I’m approaching a problem from that angle.

I’ve not done much web work with Python before, so when I get to it thats where I’ll start.