1

Hi I am adding support for CSV uploads like so :

add_filter( 'upload_mimes',  function ( $mime_types ) {

  $mime_types['csv']  = 'text/csv';

  return $mime_types;

});

How every when I try to upload the file I still get :

Sorry, this file type is not permitted for security reasons.

1 Answer 1

0

You can't upload anything except images, documents, audio or video files—and it's good for security, But in case you want to allow specific file type to upload in media library you will have to define ALLOW_UNFILTERED_UPLOADS.

Put this code in wp-config.php file.

define( 'ALLOW_UNFILTERED_UPLOADS', true ); 

This code doesn't allow every user to upload every file type, though. Only administrators are allowed to upload whatever they want.

Source: https://code.tutsplus.com/articles/new-wp-config-tweaks-you-probably-dont-know--wp-35396

https://codex.wordpress.org/Uploading_Files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.