Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Basics Managing Media in WordPress Native Audio File Support in WordPress

Tim Lefort
Tim Lefort
4,557 Points

Upload Error - "Sorry, this file type is not permitted for security reasons."

When trying to upload .mp3, .wav, and .m4a files I get this error. I did a quick Google search and I tried looking in the Settings -> Media section where there is supposed to be a section to add file types but that is not there. The other solutions I came across involved editing the function.php and other files of the likes. Is there an easy fix for this within the admin settings? Any help editing the .php files would be great as well. -Tim

7 Answers

Alexander Gyger
Alexander Gyger
14,237 Points

I have the same problem. The media upload page says it cant accept M4A files for security reasons, so it might not be a problem with the template.

I have tested it on both local installation (XAMPP) as well as in the backend of my current live WordPress website with the newest WordPress version 4.7.1, neither of them accept M4A. The 4.7.1 update had some security fixes, maybe its because of that.

On a live page you could upload the file manually with a FTP program. But in that case, I wouldnt know how you could link that file back into the media backend page.

Hi Tim,

We would need some more information on how you are doing this.

Locally? on a hosted server? etc. This would also give an idea into what is causing it.

Tim Lefort
Tim Lefort
4,557 Points

Locally. First time using "Desktop Server" as used in the course.

Thanks Tim,

I had assumed that was the case but wanted to make sure. One other question, have you tried different themes to eliminate that?

Hmm,

I tested using desktop server, locally using xampp and on a fresh install with two different hosting providers and all allowed .m4a files without issue.

Did you both try disabling all plugins? Did you also try different .m4a files? I had one from a client once that was corrupt and would not allow upload but I could do it with one I pulled out of itunes.

Tim Lefort
Tim Lefort
4,557 Points

Yes. I tried Twenty Fourteen/Fifteen?& Sixteen.

Tim Lefort
Tim Lefort
4,557 Points

Hi there, I have tried other .m4a files still with no luck. Alexander...I'm wondering if that is the case with 4.7.1. I just tried the same file supplied from the Team Treehouse demo file on a WP site that is 4.4 and it uploaded fine.

http://freewptp.com/fix-wordpress-issue-sorry-this-file-type-is-not-permitted-for-security-reasons/

I didn't see anything to in the settings menu to add additional file types but I tried the solution of adding this to wp-config.php

define('ALLOW_UNFILTERED_UPLOADS', true);

Is this an acceptable solution? It works but I want to make sure I'm not compromising any security or anything else if I use it moving forward with any projects.

Works for now at least.

-TIm

I would not advise that. That is a huge security risk.

I have tested this on 4.7.1 and even on a site that was just updated from 4.5.0 to 4.7.1 and both without issue allow it to be uploaded into the media library. Something else is causing the issue.

Elizabeth Caney
Elizabeth Caney
4,287 Points

I'm having the same issue. I tried to upload .mov .mp3 .mV4 - all are apparently supported, but the only one that is allowed to upload is .mov. Every other is 'not allowed because of security'. This .mov file then only shows up as the title surrounded by an anchor element and does not show the video - only allows people to download it.

Did anyone find a fix?

Tim Lefort
Tim Lefort
4,557 Points

Nothing yet other than that link that I posted a little while back... but that was recommended against. I kind of ignored for the time being. Obviously I am curious of what would cause this in case of coming into contact on a real project. I tried up loading the same files on a live site and had no problems so it's a little strange. Please post if you find any resolutions or comments on the issue. -Tim

Vicki Greer
Vicki Greer
5,020 Points

I tried this on a locally hosted version of WordPress 4.7.2 and also could not upload the files.

John Conlin
John Conlin
3,801 Points

Hello -- I found this fix on the WordPress site: https://wordpress.org/plugins/disable-real-mime-check/

I downloaded the plugin and put it into the /wp-content/plugins/ directory as per the readme.txt file, then I activated the plugin. Now I can upload mp3 files into posts and play them.