Errors when uploading files to Units of CoursePress

The basics of any course are of course the content of the actual course. All the rest of the stuff in CoursePress is the 'pretty-pretty' stuff.
And yet, I cannot when I try to do File Download in a Unit, the only file that I CAN actually download are
- image file,
- pdf.

The following file types cannot be added without and error message "Cannot be added for security reasons":
- docx
- PowerPoint
- html
- Excel

These are absolute basics of course content and I really should not have to mess around with code in the background to be able to download these files into a course.

Please sort out.

Thanks

  • Michelle Shull

    Hi there, Ann!

    I just set up a test unit, and I was able to upload a docx and an excel spreadsheet to my own site, so I'm guessing there's a permissions issue on what can and can't be uploaded on your site.

    1. Check to see if you've got a security plugin installed, and if there's a settings for allowed upload file types set in there.

    2. You can add this code to the functions.php file in your theme's folder in wp-content.

    function enable_extended_upload ( $mime_types =array() ) {
    
       // The MIME types listed here will be allowed in the media library.
       // You can add as many MIME types as you want.
       $mime_types['gz']  = 'application/x-gzip';
       $mime_types['zip']  = 'application/zip';
       $mime_types['rtf'] = 'application/rtf';
       $mime_types['ppt'] = 'application/mspowerpoint';
       $mime_types['docx'] = 'application/msword';
       $mime_types['flv'] = 'video/x-flv';
    
       // If you want to forbid specific file types which are otherwise allowed,
       // specify them here.  You can add as many as possible.
       unset( $mime_types['exe'] );
       unset( $mime_types['bin'] );
    
       return $mime_types;
    }
    
    add_filter('upload_mimes', 'enable_extended_upload');

    This allows PowerPoint, Word Docs, .gzip, .zip, and flash videos to be uploaded, for example, while blocking .exe and .bin files, which could contain malicious code. You can customize the allowed/disallowed types as you need to for your install.

    If you're on a multisite, this is even easier. Just go to your network dashboard, then Network Settings, and you can add approved file extensions to the provided field and wipe your hands of the whole thing.

    Hope this helps!