diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index c63fff4..bb933d4 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -1560,3 +1560,18 @@ function _views_file_status($choice = NULL) {
 
   return $status;
 }
+
+/**
+ * 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->id())
+          ->execute();
+      break;
+  }
+}
diff --git a/core/modules/file/src/Tests/FileListingTest.php b/core/modules/file/src/Tests/FileListingTest.php
index 708f138..a0ddb31 100644
--- a/core/modules/file/src/Tests/FileListingTest.php
+++ b/core/modules/file/src/Tests/FileListingTest.php
@@ -195,6 +195,61 @@ function testFileListingUsageNoLink() {
   }
 
   /**
+   * Test file deletion operation when a user is "cancelled reassign".
+   */
+  public function testUserCancelReassignFileDelete() {
+    $auth_user = $this->drupalCreateUser();
+    $super_user = $this->drupalCreateUser([
+      'cancel account',
+      'select account cancellation method',
+      'administer users',
+    ]);
+
+    $this->drupalLogin($auth_user);
+    $auth_user_id = $auth_user->id();
+    // Create a bundle and attach a File field to the bundle.
+    $bundle = $this->randomMachineName();
+    entity_test_create_bundle($bundle, NULL, 'entity_test_constraints');
+    $this->createFileField('field_test_file', 'entity_test_constraints', $bundle, array(), array('file_extensions' => 'txt png'));
+
+    // Create file to attach to entity.
+    $file = File::create([
+      'filename' => 'druplicon.txt',
+      'uri' => 'public://druplicon.txt',
+      'filemime' => 'text/plain',
+      'uid' => $auth_user_id,
+    ]);
+    $file->setPermanent();
+    file_put_contents($file->getFileUri(), 'hello world');
+    $file->save();
+
+    // Create entity and attach the created file.
+    $entity_name = $this->randomMachineName();
+    $entity = EntityTestConstraints::create(array(
+      'uid' => 1,
+      'name' => $entity_name,
+      'type' => $bundle,
+      'field_test_file' => array(
+        'target_id' => $file->id(),
+      ),
+    ));
+    $entity->save();
+
+    // Create node entity and attach the created file.
+    $node = $this->drupalCreateNode(array('type' => 'article', 'file' => $file));
+    $node->save();
+
+    $this->drupalLogin($super_user);
+    $this->drupalGet('user/' . $auth_user_id . '/cancel');
+    $edit['user_cancel_method'] = 'user_cancel_reassign';
+    $this->drupalPostForm(NULL, $edit, t('Cancel account'));
+    $result = db_query("SELECT fid FROM {file_managed} WHERE  uid = :uid", array(':uid' => $auth_user_id))->fetchField();
+    $this->assertFalse($result);
+    $result_1 = db_query("SELECT fid FROM {file_managed} WHERE  uid = :uid", array(':uid' => '0'))->fetchField();
+    $this->assertEqual($result_1, $file->id());
+  }
+
+  /**
    * Creates and saves a test file.
    *
    * @return \Drupal\Core\Entity\EntityInterface
