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);
?>
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | field_file.inc_.patch | 847 bytes | grandcat |
Comments
Comment #1
grandcat commentedSorry, 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 =)
Comment #2
drewish commentedSounds 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.
Comment #3
grandcat commentedGreat that you love my idea. I attached a patch =)
Comment #4
drewish commentedThanks, committed to HEAD.
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.