### Jazz Patch 1.0
#date: "2009-12-16 11:44:55.000000210 -0500"
#itemid: "application/helpmeinvest.scotiabank.com/modules/emfield/contrib/emthumb" "_OKhh1c06Ed6ELLSyEdmDlg" "_5nudQMr2Ed6rJPMQZ2C4Zw"
#itemid: "application/helpmeinvest.scotiabank.com/modules/emfield/contrib/emthumb/emthumb.module" "_OM6HdM06Ed6ELLSyEdmDlg" "_5nudQMr2Ed6rJPMQZ2C4Zw"
#before_state: "application/helpmeinvest.scotiabank.com/modules/emfield/contrib/emthumb/emthumb.module" "_OM6HdM06Ed6ELLSyEdmDlg" "_TVpGdM07Ed6hyrgWLBgryQ"
#after_state: "application/helpmeinvest.scotiabank.com/modules/emfield/contrib/emthumb/emthumb.module" "_OM6HdM06Ed6ELLSyEdmDlg" "_hnMp4OXVEdqfgdmADyqO4w"
#
diff -u -N application/helpmeinvest.scotiabank.com/modules/emfield/contrib/emthumb/emthumb.module application/helpmeinvest.scotiabank.com/modules/emfield/contrib/emthumb/emthumb.module
--- application/helpmeinvest.scotiabank.com/modules/emfield/contrib/emthumb/emthumb.module	2009-10-30 18:12:28.000000000 -0400
+++ application/helpmeinvest.scotiabank.com/modules/emfield/contrib/emthumb/emthumb.module	1969-12-31 19:00:00.000000017 -0500
@@ -589,10 +589,6 @@
         $file->filename = $basename_arr['path'];
         $file->filepath = $filepath_arr['path'];
 
-        // If we have mimedetect, then do so. Otherwise we make a best guess
-        // based on the filename.
-        $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')) {
           $file->filemime = 'text/plain';
@@ -635,6 +631,11 @@
           watchdog('file', 'Upload error. Could not move file %file to destination %destination.', array('%file' => $file->filename, '%destination' => $file->destination));
           return 0;
         }
+        
+        // If we have mimedetect, then do so. Otherwise we make a best guess
+        // based on the filename.
+        $file->filemime = module_exists('mimedetect') ? mimedetect_mime($file) : file_get_mimetype($file->filename);
+        
         // If we made it this far it's safe to record this file in the database.
         $file->status = FILE_STATUS_PERMANENT;
         $file->timestamp = time();
