diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index f31fdfa..ed9fb54 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -1020,3 +1020,28 @@ function file_get_file_references($file, $field = NULL, $age = FIELD_LOAD_REVISI
 /**
  * @} End of "defgroup file-module-api".
  */
+
+/**
+ * Implements hook_user_cancel().
+ */
+function file_user_cancel($edit, $account, $method) {
+  switch ($method) {
+    case 'user_cancel_reassign':
+      // Anonymize files.
+      db_update('file_managed')
+        ->fields(array('uid' => 0))
+        ->condition('uid', $account->uid)
+        ->execute();
+      break;
+
+    case 'user_cancel_reassign':
+  }
+}
+
+/**
+ * Implements hook_user_predelete().
+ */
+function file_user_predelete($account) {
+  $fids = db_query('SELECT f.fid FROM {file_managed} f WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
+  entity_delete_multiple('file', $fids);
+}
