Commit 469957a8 authored by drewish's avatar drewish

#299380 by grandcat, use file_get_mimetype() when mimedetect.module is not installed.

parent 2635f5af
......@@ -135,7 +135,7 @@ function field_file_save_file($filepath, $validators = array(), $dest = FALSE, $
$file->uid = $user->uid;
$file->filename = basename($filepath);
$file->filepath = $filepath;
$file->filemime = module_exists('mimedetect') ? mimedetect_mime($file) : 'text/plain';
$file->filemime = module_exists('mimedetect') ? mimedetect_mime($file) : file_get_mimetype($file->filename);
// Rename potentially executable files, to help prevent exploits.
if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $file->filename) && (substr($file->filename, -4) != '.txt')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment