For my module image_fupload, I need the function "field_file_save_file" in "field_file.inc" to mass import image files. But if the module MimeDetect isn't installed, it is always returned "text/plain" as mimetype. That's a bad idea I think, because Drupal itself comes with a function to determine the mimetype.
So, it would be great to replace the following lines of code

<?php
$file->filemime = module_exists('mimedetect') ? mimedetect_mime($file) : 'text/plain';
?>

with these ones:

<?php
$file->filemime = module_exists('mimedetect') ? mimedetect_mime($file) : file_get_mimetype($file->filename);
?>
CommentFileSizeAuthor
#3 field_file.inc_.patch847 bytesgrandcat

Comments

grandcat’s picture

Sorry, I forgot to mention that this solution would be much better and also had better functionality because everybody doesn't absolutely want to have a module which additionally needs more man 200K what costs additional server performance.
Thanks for your understandings =)

drewish’s picture

Sounds good to me. That function was just added in the last security update and wasn't available when I wrote that function. Please roll a patch.

grandcat’s picture

Status: Active » Needs review
StatusFileSize
new847 bytes

Great that you love my idea. I attached a patch =)

drewish’s picture

Status: Needs review » Fixed

Thanks, committed to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.