Support » Fixing WordPress » Error message: Can’t upload any CSV file in Media Library

  • Hi

    I recently updated my WordPress platforms from version 4.7 to version 4.7.1 to solve the security problems that had been reported.

    After upgrading to version 4.7.1, users accessing the platforms we manage have problems uploading a “CSV” file. WordPress platforms we manage are multisite platforms.

    When trying to upload a CSV file from Media – Add new, the error message that appears on the screen is the following:

    “Sorry, for security reasons, such files are not allowed.”

    The allowed extensions filter is configured in the Network Administrator – Settings – Network Settings and in “Allowed File Type” already from previous versions of WordPress we had the following permitted file filter:

    Jpg jpeg png gif svg mp3 m4a wav ogg oga mp4 ogv webm mov avi wmv flv midi mid swf pdf doc doc odt odg odds ods xls xlsx csv zip gz gzip wma rar ppt ppt pptx pps ppsx

    It only gives error when I try to upload a file with .csv extension. I have tried with almost all other types of files allowed and I do not have any problem when uploading them, only gives error when the file that is tried to upload is type .csv.

    Temporary, in wp-config.php has been added the line

    define (‘ALLOW_UNFILTERED_UPLOADS’, true);

    This represents a risk since you can upload any type of file to the platform.

    It would be possible to solve the problem to avoid having to put this line of code in the wp-config.php of our platforms.

    Many thanks in advance

    Regards

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    It’s a known bug. See this for more information and a temporary work-around:

    https://wordpress.org/support/topic/read-this-first-wordpress-4-7-master-list/?view=all#post-8521428

    Thank you so much!!!

    I also get an error when I try to upload CSV file:
    “Sorry, this file type is not permitted for security reasons.”

    I also try to add mime type but it not work:

    function enable_extended_upload ($mime_types=array()){
       $mime_types['csv']	=	'application/octet-stream';
       return $mime_types;
    }
    add_filter('upload_mimes','enable_extended_upload');

    Hello everyone I found a solution:
    With the upgrade to WordPress 4.7.1, some non-image files fail to upload on certain server setups,

    This will be fixed in 4.7.2, You can disable real mime check for now (WP 4.7.1) and Please remove the plugin once WordPress 4.7.2 is available!

    function cf_disable_real_mime_check($data,$file,$filename,$mimes){
    	$wp_filetype		=	wp_check_filetype($filename,$mimes);
    	$ext				=	$wp_filetype['ext'];
    	$type				=	$wp_filetype['type'];
    	$proper_filename	=	$data['proper_filename'];
    	return compact('ext','type','proper_filename');
    }
    add_filter('wp_check_filetype_and_ext','cf_disable_real_mime_check',10,4);
    • This reply was modified 2 years, 7 months ago by  Manoj Singh.
    • This reply was modified 2 years, 7 months ago by  Manoj Singh.

    Hello everyone,

    I just updated to version 4.7.2, which just came out recently, to see that it effectively solves the problem of uploading certain files.

    As they indicated, I disabled and uninstalled the “Disable Real MIME Check” plugin, and I tried uploading csv files, and it still gives the same error:

    When trying to upload to CSV file from Media – Add new, the error message that appears on the screen is the following:

    “Sorry, for security reasons, such files are not allowed.”

    As far as this error is seen they have not solved it in the new version released as they had stated days ago.

    Regards.

    Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    The fix for the mime problem got pushed back to 4.7.3. Re-enable that plugin.

    Always check the “Master List” post for updated info:

    https://wordpress.org/support/topic/read-this-first-wordpress-4-7-master-list/

    Ok.

    Thank so much. We wait for update to 4.7.3 version.

    I’m running 4.7.3 and multisite and still having the issue. Did this get pushed to 4.7.4?

    We are running a multisite instance on 4.7.4 and are experiencing the same issue. While on 4.7.2 we used the Disable Real MIME Check plugin successfully. Then I thought the word was to uninstall it going to 4.7.3 (or 4.7.4) and I did so but the problem has cropped up again. Now I’m wondering if I should reinstall and network activate.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Error message: Can’t upload any CSV file in Media Library’ is closed to new replies.