Support » Plugin: WordPress Media Library Folders » WordPress 4.9.9 (or 5.0.1) Results in “file type invalid” Error

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author AlanP57

    (@alanp57)

    I’ll add the new mine types and try uploading those types of files and see if this can be fixed. At this time, Media Library Folders does not support unfiltered uploads.

    Plugin Author AlanP57

    (@alanp57)

    I have added this code for adding mine types:

    function cc_mime_types($mimes) {
      $mimes['svg'] = 'image/svg+xml';
      $mimes['exe'] = 'program/exe';
      $mimes['dwg'] = 'image/dwg';
      return $mimes;
    }
    add_filter('upload_mimes', 'cc_mime_types');

    And it allows the upload of SVG files but not DWG files to the media library. Is the code that you are using different?

    mikedev

    (@mikedev)

    Yes, that’s the same code I’m using. Except I used ‘application/acad’ as the mime type for dwg. My function also did not enable uploads of dwg files.

    Plugin Author AlanP57

    (@alanp57)

    I’ve updated my code and now I am able to upload a dwg files to both to the media library and Media Library Folders. I was not able to reproduce the error using version of 4.3.3 of Media Library Folders and WP 5.0.0, but I did reproduce the error with both the media library and Media Library Folders after updating to WP 5.0.1. Thus, this is an issue with WP 5.0.1.

    mikedev

    (@mikedev)

    Yes, it’s an issue introduced in WP 5.0.1. See “MIME validation for uploaded files” at https://make.wordpress.org/core/2018/12/13/backwards-compatibility-breaks-in-5-0-1/.

    (I have deleted the Disable Real MIME Check plugin.)

    I found that $mimes['dwg'] = 'image/vnd.dwg'; is the only media type that works for the dwg files I’m uploading.

    With the function in my theme’s functions.php I am now able to upload dwg files to both to the media library and Media Library Folders. I’m not sure this fix is appropriate to add to the Media Library Folders plugin, because dwg files created with different applications might validate with a different media type. (There are three media types for dwg listed here https://www.sitepoint.com/mime-types-complete-list/.)

    Thanks for the great support for a great plugin!

    mikedev

    (@mikedev)

    Can you please also add $mimes['rfa'] = 'application/octet-stream'; to your plugin?

    If define('ALLOW_UNFILTERED_UPLOADS', true); is added to wp-config.php, it allows upload of all file types. Then uploading .rfa files works with the core media uploader, but when using the Media Library Folders uploader it says “*.rfa file’s type is invalid.”

    Plugin Author AlanP57

    (@alanp57)

    This is a good idea. I’ve added it to the plugin and it will be include in release , which may go out today.

    Excellent work. Now, with define('ALLOW_UNFILTERED_UPLOADS', true); in wp-config.php, the Media Library Folders uploader allows upload of .rfa files.

    Thanks again for your support on a great plugin!

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.