diff --git a/file_entity/file_entity.install b/file_entity/file_entity.install
index 6c6e79d..e793a08 100644
--- a/file_entity/file_entity.install
+++ b/file_entity/file_entity.install
@@ -163,6 +163,19 @@ function file_entity_update_7001() {
 }
 
 /**
+ * Update all files with empty types to use the first part of filemime.
+ *
+ * For example, an png image with filemime 'image/png' will be assigned a file
+ * type of 'image'.
+ */
+function file_entity_update_7002() {
+  db_update('file_managed')
+    ->expression('type', "SUBSTRING_INDEX(filemime, '/', 1)")
+    ->condition('type', '')
+    ->execute();
+}
+
+/**
  * Implement hook_uninstall().
  */
 function file_entity_uninstall() {
