Fix WordPress Download Monitor “No File Selected” Error

About a week back, I was writing a post on this blog and wanted to attach a shell script using WordPress Download Monitor. However when I tried to attach the script file (.sh extension), it gave me “No File Selected” error after trying to upload the file. Tried again, and the same result. I uploaded a zipped version of the file and that uploaded fine. So I figured, it must be an issue with the mime type/file extension. Found this link which reports the same issue and the solution.

Here’s how you fix this.

1. Log on to your server either through SSH or FTP.

2. Change directory to wp-includes directory in the root of your wordpress installation. For Eg (in my case)

cd ~/

3. Open the functions.php file with your favourite editor.

vi functions.php

4. Search for the get_allowed_mime_types function. At the time of writing, its at line 2275.

5. Go to the bottom of the function (Shift + ] in vim) and add a new entry at the end of all the mime type entries for the desired mime type. At the time of writing, all the openoffice formats are the bottom most entries.

// openoffice formats
 'odt' => 'application/vnd.oasis.opendocument.text',
 'odp' => 'application/vnd.oasis.opendocument.presentation',
 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
 'odg' => 'application/',
 'odc' => 'application/vnd.oasis.opendocument.chart',
 'odb' => 'application/vnd.oasis.opendocument.database',
 'odf' => 'application/vnd.oasis.opendocument.formula',

6.  See the sample screenshot below for the new ‘sh’ mime type entry. Check this link for a list of mime types.

1 comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.