Support » Fixing WordPress » Can't upload swf files to wordpress anymore.

  • Resolved chrisntoukas



    I have WordPress version 3.6.1 and i cant upload any swf files because of this message ‘ Sorry, this file type is not permitted for security reasons.’

    Can anyone help me ?
    Thanks in advance.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thanks for your answer.
    I did that but now i cant upload any kind of images files on my site.

    The sample code in the previous post is incorrect. It replaces all other mime types with only swf and exe. It needs to add the missing types to the existing allowed mime types:

    function demo($mimes) {
    	if ( function_exists( 'current_user_can' ) )
    		$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
    	if ( !empty( $unfiltered ) ) {
    		$mimes['swf'] = 'application/x-shockwave-flash';
    	return $mimes;

    I left out “exe” because that wasn’t asked for and I wouldn’t allow it normally. If you want that as well, just add this line:

    $mimes['exe'] = 'application/x-msdownload';

    That worked perfectly. Now i can upload swf files and any kind of images.
    Thanks a lot, i appreciate that.

    chrisntoukas, you’re quite welcome! If you don’t mind, please mark the topic as resolved to help others who may have run across the same incorrect code in the other post.

    I used this to upload swf files to my website as well:

    However, once I have it uploaded I am having trouble embedding it into a project at a specific size. I have tried multiple plug-ins but most don’t work in any browser. Top Flash Embed was the only one I found that was compatable with 3.6.1 but development has stopped and I’m having sizing and cross platform issues with it.

    Maybe there is a plug-in someone can suggest or some code perhaps?

    Thanks in advance!

    Since this particular topic is resolved, and the question you have is actually quite different from the original topic, please post a new topic for your question. Thanks!

    Hey guys i am a newbie can you tell me where is this code to replace???

    Hey mate.

    Just copy the code Scriptrunner wrote above and place it in the last line of functions.php above the php closure.

    the code goes here.

    Save your functions.php before make any changes on it.

    Hey Chrisntoukas and friends, I try to search the last line of function.php from the editor that ending with :


    but still i couldnt find it.
    For your information,i’m using twentytwelve theme.

    Could you or any other friend help me to solve this problem

    Common php best practice is to not include the closing “?>” php tag if it’s the last line in the file. Just put the code above at the bottom of functions.php. (actually, it can go anywhere in the file.)

    @hamizul – if you need further help, please stick to your own thread – posting in more than one place makes it much harder for people here to help you –

    I am using elegant theme Lumin. I have tried adding this code to the functions php but it ignores the code. Is there a different place I need to add it?

    Andrew Nevins


    WCLDN 2018 Contributor | Volunteer support

    Try Elegant Themes’ support forum:

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Can't upload swf files to wordpress anymore.’ is closed to new replies.