diff --git a/webform.install b/webform.install
index a7bb327..02f672a 100644
--- a/webform.install
+++ b/webform.install
@@ -937,7 +937,7 @@ function webform_update_7320() {
  * Rewrite token replacement system to use D7 tokens.
  *
  * If needed, please download and install the Token module from drupal.org.
- * Otherwise some tokens will not be rendered. 
+ * Otherwise some tokens will not be rendered.
  */
 function webform_update_7401(&$sandbox) {
   // Define replacements.
@@ -1318,3 +1318,15 @@ function webform_update_7403(&$sandbox) {
     $sandbox['#finished'] = $sandbox['progress'] / $sandbox['max'];
   }
 }
+
+/**
+ * Remove files left over from deleted submissions. Such files are now deleted
+ * automatically.
+ */
+function webform_update_7404() {
+  module_load_include('inc', 'webform', 'components/file');
+  $fid_s = db_query('SELECT fid FROM {file_usage} WHERE module = \'webform\' AND type = \'submission\' AND NOT id IN(SELECT sid FROM {webform_submissions})')->fetchCol();
+  foreach ($fid_s as $fid) {
+    _webform_delete_file(NULL, array($fid));
+  }
+}
