CSV file not uploading on Wordpress

后端 未结 4 1684
再見小時候
再見小時候 2021-01-21 10:22

I\'m unable to upload CSV file on the WordPress website

error: Sorry, this file type is not permitted for security reasons

Check the following

相关标签:
4条回答
  • 2021-01-21 10:48

    I believe, everything is clearly mentioned in the error and you highlighted that too : This file type is not permitted for security reasons

    To fix this, add this code in wp-config.php

    define('ALLOW_UNFILTERED_UPLOADS', true);
    

    Or you can also use a Plugin called "WP Add Mime Types", And add ONLY types which you want to be added

    0 讨论(0)
  • 2021-01-21 11:03

    Define this in wp-config.php.

    define(‘ALLOW_UNFILTERED_UPLOADS’, true)
    

    Add this code to your function.php file

    function enable_extended_upload ( $mime_types =array() ) { $mime_types[‘gz’]  = ‘application/x-gzip’; $mime_types[‘zip’]  = ‘application/zip’; $mime_types[‘rtf’] = ‘application/rtf’; $mime_types[‘ppt’] = ‘application/mspowerpoint’; $mime_types[‘ps’] = ‘application/postscript’; $mime_types[‘flv’] = ‘video/x-flv’; unset( $mime_types[‘exe’] ); unset( $mime_types[‘bin’] ); return $mime_types; } add_filter(‘upload_mimes’, ‘enable_extended_upload’);
    
    0 讨论(0)
  • 2021-01-21 11:04

    I had the same error and find out the problem was the export had been created uising a different wordpress admin language. After renaming the fileds to match the target system language everything worked like it should. This means the error message is kind of useless in this case. I have lost a few days of my remaining life because of this error :(

    0 讨论(0)
  • 2021-01-21 11:05

    In case you are developing a custom theme , add this to your function.php to authorize mimes for uploads :

    function my_custom_mime_types( $mimes ) {
    
    // New allowed mime types.
    $mimes['csv'] = 'text/csv';
    
    // Optional. Remove a mime type.
    unset( $mimes['exe'] );
    
    return $mimes;
    }
    

    Add it to the filter upload_mimes

    add_filter( 'upload_mimes', 'my_custom_mime_types' );
    

    Check here the rest of all mimes type you can authorize.

    The point here is that you are controlling all authorized mimes in your website .

    0 讨论(0)
提交回复
热议问题