How to allow .ged file uploads

admin2025-06-05  2

I am trying to allow gedcom file uploads. These files have a .ged extension.

Gedcom files do not have a mime type.

I have tried the following code with various text/types such as csv, rtf etc without success.

    function my_mime_types($mime_types){
$mime_types['ged'] = 'text/csv';
    return $mime_types;}
add_filter('upload_mimes', 'my_mime_types', 1, 1);

Any suggestions as to how to add this type of file extension to the permitted uploads?

I am trying to allow gedcom file uploads. These files have a .ged extension.

Gedcom files do not have a mime type.

I have tried the following code with various text/types such as csv, rtf etc without success.

    function my_mime_types($mime_types){
$mime_types['ged'] = 'text/csv';
    return $mime_types;}
add_filter('upload_mimes', 'my_mime_types', 1, 1);

Any suggestions as to how to add this type of file extension to the permitted uploads?

Share Improve this question asked Dec 20, 2018 at 12:00 ColinColin 1356 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

you need to allow them to be uploaded in your media files.

you can add following code to your themes functions.php and it should work.

function my_mime_types($mime_types){
    $mime_types['ged'] = 'application/octet-stream';
    return $mime_types;
}
add_filter('upload_mimes', 'my_mime_types', 1, 1);

there is more information about adding new mime types in WP here: https://wpsmackdown/add-remove-filetypes-wordpress-media-library/#add-filetypes

Here is an info about the .ged File MIME Type: https://whatis.techtarget/fileformat/GED-Genealogical-data-GEDCOM

And here a list of the mime_types: https://feedforall/mime-types.htm

I have now resolved this by changing the type to text/plain so the code now looks like:

function my_mime_types($mime_types){
$mime_types['ged'] = 'text/plain';
return $mime_types;}
add_filter('upload_mimes', 'my_mime_types', 1, 1);

It seems that a security patch in v5.0.1 and v4.9.9 has tightened up the mime type of uploads and the checking of the file types.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749080861a316195.html

最新回复(0)