We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Support Find a Developer Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Support Find a Developer Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Allowing .exe files to be uploaded - mime types

How Do I?

Antenna's avatar
Antenna
87 posts
6 months ago
Antenna's avatar Antenna

Hi,

I’m building a “downloads” page for a client and some of the downloads are .exe files which, by default, are not allowed file types.

I’ve tried adding .exe mime types to:

system/ee/EllisLab/ExpressionEngine/Config/mimes.php

…but still get a ‘File not allowed’ message when trying to upload an .exe file.

These are the mime types I’ve tried adding to the mimes.php whitelist:

application/x-msdownload application/octet-stream application/x-zip-compressed application/vnd.microsoft.portable-executable

…none of which appear to work for me. Any ideas where I’m going wrong?

Many thanks,

Andy

       
Rob Allen's avatar
Rob Allen
2,916 posts
6 months ago
Rob Allen's avatar Rob Allen

Your mime types look ok, check to see if your upload directory is set to allow “All files”.

       
Antenna's avatar
Antenna
87 posts
6 months ago
Antenna's avatar Antenna

Thanks for your reply, Rob. Yes, the directory is set to allow ‘All Files’ – I can upload PDFs to it without any issues.

       
Robin Sowell's avatar
Robin Sowell
13,142 posts
5 months ago
Robin Sowell's avatar Robin Sowell

I’d check and see what it’s seeing those files as. FTP one up- then go to a template, turn php parsing on, and put this:

<?php
ee()->load->library('mime_type');

$path = '/Users/robinb/sites/exp5/exp-bad.pdf';
$out = ee()->mime_type->ofFile($path);

print_r($out);
?>

Change the $path so it’s the path to the exe file you ftp’d up. Just see what it prints out. I tested with a pdf and I got: application/pdf

👍 1
       
Antenna's avatar
Antenna
87 posts
5 months ago
Antenna's avatar Antenna

Hi Robin,

Many thanks for your response, much appreciated. I followed your advice and found out the mime type was ‘application/x-dosexec’. I added this to /Config/mimes.php and all is good now!

A huge thank you!

       
Robin Sowell's avatar
Robin Sowell
13,142 posts
5 months ago
Robin Sowell's avatar Robin Sowell

I swear, they don’t make dealing with mime type easy! Glad that’s got you working.

😃 1
       
Antenna's avatar
Antenna
87 posts
5 months ago
Antenna's avatar Antenna

It certainly had me baffled! Thanks for your guidance 👍

       

Reply

Sign In To Reply

ExpressionEngine Home Features Contact
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.