admin管理员组文章数量:1130349
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 badges2 Answers
Reset to default 0you 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.
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 badges2 Answers
Reset to default 0you 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.
本文标签: How to allow ged file uploads
版权声明:本文标题:How to allow .ged file uploads 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749080836a2313024.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论