diff --git a/core/includes/file.inc b/core/includes/file.inc
index cbddc61..d913a03 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -9,8 +9,6 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 use Symfony\Component\HttpFoundation\StreamedResponse;
 use Drupal\Core\StreamWrapper\LocalStream;
-use Drupal\Core\File\File;
-
 /**
  * Stream wrapper bit flags that are the basis for composite types.
  *
@@ -578,247 +576,6 @@ function file_save_htaccess($directory, $private = TRUE) {
 }
 
 /**
- * Loads file entities from the database.
- *
- * @param array $fids
- *   (optional) An array of entity IDs. If omitted, all entities are loaded.
- *
- * @return array
- *   An array of file entities, indexed by fid.
- *
- * @see hook_file_load()
- * @see file_load()
- * @see entity_load()
- * @see Drupal\entity\EntityFieldQuery
- */
-function file_load_multiple(array $fids = NULL) {
-  return entity_load_multiple('file', $fids);
-}
-
-/**
- * Loads a single file entity from the database.
- *
- * @param $fid
- *   A file ID.
- *
- * @return Drupal\Core\File\File
- *   A file entity or FALSE if the file was not found.
- *
- * @see hook_file_load()
- * @see file_load_multiple()
- */
-function file_load($fid) {
-  $files = file_load_multiple(array($fid));
-  return reset($files);
-}
-
-/**
- * Determines where a file is used.
- *
- * @param Drupal\Core\File\File $file
- *   A file entity.
- *
- * @return
- *   A nested array with usage data. The first level is keyed by module name,
- *   the second by object type and the third by the object id. The value
- *   of the third level contains the usage count.
- *
- * @see file_usage_add()
- * @see file_usage_delete()
- */
-function file_usage_list(File $file) {
-  $result = db_select('file_usage', 'f')
-    ->fields('f', array('module', 'type', 'id', 'count'))
-    ->condition('fid', $file->fid)
-    ->condition('count', 0, '>')
-    ->execute();
-  $references = array();
-  foreach ($result as $usage) {
-    $references[$usage->module][$usage->type][$usage->id] = $usage->count;
-  }
-  return $references;
-}
-
-/**
- * Records that a module is using a file.
- *
- * Examples:
- * - A module that associates files with nodes, so $type would be
- *   'node' and $id would be the node's nid. Files for all revisions are stored
- *   within a single nid.
- * - The User module associates an image with a user, so $type would be 'user'
- *   and the $id would be the user's uid.
- *
- * @param Drupal\Core\File\File $file
- *   A file entity.
- * @param $module
- *   The name of the module using the file.
- * @param $type
- *   The type of the object that contains the referenced file.
- * @param $id
- *   The unique, numeric ID of the object containing the referenced file.
- * @param $count
- *   (optional) The number of references to add to the object. Defaults to 1.
- *
- * @see file_usage_list()
- * @see file_usage_delete()
- */
-function file_usage_add(File $file, $module, $type, $id, $count = 1) {
-  db_merge('file_usage')
-    ->key(array(
-      'fid' => $file->fid,
-      'module' => $module,
-      'type' => $type,
-      'id' => $id,
-    ))
-    ->fields(array('count' => $count))
-    ->expression('count', 'count + :count', array(':count' => $count))
-    ->execute();
-
-  // Make sure that a used file is permament.
-  if ($file->status != FILE_STATUS_PERMANENT) {
-    $file->status = FILE_STATUS_PERMANENT;
-    $file->save();
-  }
-}
-
-/**
- * Removes a record to indicate that a module is no longer using a file.
- *
- * @param Drupal\Core\File\File $file
- *   A file entity.
- * @param $module
- *   The name of the module using the file.
- * @param $type
- *   (optional) The type of the object that contains the referenced file. May
- *   be omitted if all module references to a file are being deleted.
- * @param $id
- *   (optional) The unique, numeric ID of the object containing the referenced
- *   file. May be omitted if all module references to a file are being deleted.
- * @param $count
- *   (optional) The number of references to delete from the object. Defaults to
- *   1. 0 may be specified to delete all references to the file within a
- *   specific object.
- *
- * @see file_usage_add()
- * @see file_usage_list()
- */
-function file_usage_delete(File $file, $module, $type = NULL, $id = NULL, $count = 1) {
-  // Delete rows that have a exact or less value to prevent empty rows.
-  $query = db_delete('file_usage')
-    ->condition('module', $module)
-    ->condition('fid', $file->fid);
-  if ($type && $id) {
-    $query
-      ->condition('type', $type)
-      ->condition('id', $id);
-  }
-  if ($count) {
-    $query->condition('count', $count, '<=');
-  }
-  $result = $query->execute();
-
-  // If the row has more than the specified count decrement it by that number.
-  if (!$result && $count > 0) {
-    $query = db_update('file_usage')
-      ->condition('module', $module)
-      ->condition('fid', $file->fid);
-    if ($type && $id) {
-      $query
-        ->condition('type', $type)
-        ->condition('id', $id);
-    }
-    $query->expression('count', 'count - :count', array(':count' => $count));
-    $query->execute();
-  }
-
-  // If there are no more remaining usages of this file, mark it as temporary,
-  // which result in a delete through system_cron().
-  $usage = file_usage_list($file);
-  if (empty($usage)) {
-    $file->status = 0;
-    $file->save();
-  }
-}
-
-/**
- * Copies a file to a new location and adds a file record to the database.
- *
- * This function should be used when manipulating files that have records
- * stored in the database. This is a powerful function that in many ways
- * performs like an advanced version of copy().
- * - Checks if $source and $destination are valid and readable/writable.
- * - Checks that $source is not equal to $destination; if they are an error
- *   is reported.
- * - If file already exists in $destination either the call will error out,
- *   replace the file or rename the file based on the $replace parameter.
- * - Adds the new file to the files database. If the source file is a
- *   temporary file, the resulting file will also be a temporary file. See
- *   file_save_upload() for details on temporary files.
- *
- * @param Drupal\Core\File\File $source
- *   A file entity.
- * @param $destination
- *   A string containing the destination that $source should be copied to.
- *   This must be a stream wrapper URI.
- * @param $replace
- *   Replace behavior when the destination file already exists:
- *   - FILE_EXISTS_REPLACE - Replace the existing file. If a managed file with
- *       the destination name exists then its database entry will be updated. If
- *       no database entry is found then a new one will be created.
- *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is
- *       unique.
- *   - FILE_EXISTS_ERROR - Do nothing and return FALSE.
- *
- * @return
- *   File object if the copy is successful, or FALSE in the event of an error.
- *
- * @see file_unmanaged_copy()
- * @see hook_file_copy()
- */
-function file_copy(File $source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
-  if (!file_valid_uri($destination)) {
-    if (($realpath = drupal_realpath($source->uri)) !== FALSE) {
-      watchdog('file', 'File %file (%realpath) could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->uri, '%realpath' => $realpath, '%destination' => $destination));
-    }
-    else {
-      watchdog('file', 'File %file could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->uri, '%destination' => $destination));
-    }
-    drupal_set_message(t('The specified file %file could not be copied because the destination is invalid. More information is available in the system log.', array('%file' => $source->uri)), 'error');
-    return FALSE;
-  }
-
-  if ($uri = file_unmanaged_copy($source->uri, $destination, $replace)) {
-    $file = clone $source;
-    $file->fid = NULL;
-    $file->uri = $uri;
-    $file->filename = drupal_basename($uri);
-    // If we are replacing an existing file re-use its database record.
-    if ($replace == FILE_EXISTS_REPLACE) {
-      $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
-      if (count($existing_files)) {
-        $existing = reset($existing_files);
-        $file->fid = $existing->fid;
-        $file->filename = $existing->filename;
-      }
-    }
-    // If we are renaming around an existing file (rather than a directory),
-    // use its basename for the filename.
-    elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
-      $file->filename = drupal_basename($destination);
-    }
-
-    $file->save();
-
-    // Inform modules that the file has been copied.
-    module_invoke_all('file_copy', $file, $source);
-
-    return $file;
-  }
-  return FALSE;
-}
-
-/**
  * Determines whether the URI has a valid scheme for file API operations.
  *
  * There must be a scheme and it must be a Drupal-provided scheme like
@@ -993,86 +750,6 @@ function file_destination($destination, $replace) {
 }
 
 /**
- * Moves a file to a new location and update the file's database entry.
- *
- * Moving a file is performed by copying the file to the new location and then
- * deleting the original.
- * - Checks if $source and $destination are valid and readable/writable.
- * - Performs a file move if $source is not equal to $destination.
- * - If file already exists in $destination either the call will error out,
- *   replace the file or rename the file based on the $replace parameter.
- * - Adds the new file to the files database.
- *
- * @param Drupal\Core\File\File $source
- *   A file entity.
- * @param $destination
- *   A string containing the destination that $source should be moved to.
- *   This must be a stream wrapper URI.
- * @param $replace
- *   Replace behavior when the destination file already exists:
- *   - FILE_EXISTS_REPLACE - Replace the existing file. If a managed file with
- *       the destination name exists then its database entry will be updated and
- *       $source->delete() called after invoking hook_file_move().
- *       If no database entry is found then the source files record will be
- *       updated.
- *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is
- *       unique.
- *   - FILE_EXISTS_ERROR - Do nothing and return FALSE.
- *
- * @return Drupal\Core\File\File
- *   Resulting file entity for success, or FALSE in the event of an error.
- *
- * @see file_unmanaged_move()
- * @see hook_file_move()
- */
-function file_move(File $source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
-  if (!file_valid_uri($destination)) {
-    if (($realpath = drupal_realpath($source->uri)) !== FALSE) {
-      watchdog('file', 'File %file (%realpath) could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->uri, '%realpath' => $realpath, '%destination' => $destination));
-    }
-    else {
-      watchdog('file', 'File %file could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->uri, '%destination' => $destination));
-    }
-    drupal_set_message(t('The specified file %file could not be moved because the destination is invalid. More information is available in the system log.', array('%file' => $source->uri)), 'error');
-    return FALSE;
-  }
-
-  if ($uri = file_unmanaged_move($source->uri, $destination, $replace)) {
-    $delete_source = FALSE;
-
-    $file = clone $source;
-    $file->uri = $uri;
-    // If we are replacing an existing file re-use its database record.
-    if ($replace == FILE_EXISTS_REPLACE) {
-      $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
-      if (count($existing_files)) {
-        $existing = reset($existing_files);
-        $delete_source = TRUE;
-        $file->fid = $existing->fid;
-      }
-    }
-    // If we are renaming around an existing file (rather than a directory),
-    // use its basename for the filename.
-    elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
-      $file->filename = drupal_basename($destination);
-    }
-
-    $file->save();
-
-    // Inform modules that the file has been moved.
-    module_invoke_all('file_move', $file, $source);
-
-    // Delete the original if it's not in use elsewhere.
-    if ($delete_source && !file_usage_list($source)) {
-      $source->delete();
-    }
-
-    return $file;
-  }
-  return FALSE;
-}
-
-/**
  * Moves a file to a new location without database changes or hook invocation.
  *
  * @param $source
@@ -1609,267 +1286,6 @@ function drupal_move_uploaded_file($filename, $uri) {
 }
 
 /**
- * Checks that a file meets the criteria specified by the validators.
- *
- * After executing the validator callbacks specified hook_file_validate() will
- * also be called to allow other modules to report errors about the file.
- *
- * @param Drupal\Core\File\File $file
- *   A file entity.
- * @param $validators
- *   An optional, associative array of callback functions used to validate the
- *   file. The keys are function names and the values arrays of callback
- *   parameters which will be passed in after the file entity. The
- *   functions should return an array of error messages; an empty array
- *   indicates that the file passed validation. The functions will be called in
- *   the order specified.
- *
- * @return
- *   An array containing validation error messages.
- *
- * @see hook_file_validate()
- */
-function file_validate(File $file, $validators = array()) {
-  // Call the validation functions specified by this function's caller.
-  $errors = array();
-  foreach ($validators as $function => $args) {
-    if (function_exists($function)) {
-      array_unshift($args, $file);
-      $errors = array_merge($errors, call_user_func_array($function, $args));
-    }
-  }
-
-  // Let other modules perform validation on the new file.
-  return array_merge($errors, module_invoke_all('file_validate', $file));
-}
-
-/**
- * Checks for files with names longer than can be stored in the database.
- *
- * @param Drupal\Core\File\File $file
- *   A file entity.
- *
- * @return
- *   An array. If the file name is too long, it will contain an error message.
- */
-function file_validate_name_length(File $file) {
-  $errors = array();
-
-  if (empty($file->filename)) {
-    $errors[] = t("The file's name is empty. Please give a name to the file.");
-  }
-  if (strlen($file->filename) > 240) {
-    $errors[] = t("The file's name exceeds the 240 characters limit. Please rename the file and try again.");
-  }
-  return $errors;
-}
-
-/**
- * Checks that the filename ends with an allowed extension.
- *
- * @param Drupal\Core\File\File $file
- *   A file entity.
- * @param $extensions
- *   A string with a space separated list of allowed extensions.
- *
- * @return
- *   An array. If the file extension is not allowed, it will contain an error
- *   message.
- *
- * @see hook_file_validate()
- */
-function file_validate_extensions(File $file, $extensions) {
-  $errors = array();
-
-  $regex = '/\.(' . preg_replace('/ +/', '|', preg_quote($extensions)) . ')$/i';
-  if (!preg_match($regex, $file->filename)) {
-    $errors[] = t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => $extensions));
-  }
-  return $errors;
-}
-
-/**
- * Checks that the file's size is below certain limits.
- *
- * This check is not enforced for the user #1.
- *
- * @param Drupal\Core\File\File $file
- *   A file entity.
- * @param $file_limit
- *   An integer specifying the maximum file size in bytes. Zero indicates that
- *   no limit should be enforced.
- * @param $user_limit
- *   An integer specifying the maximum number of bytes the user is allowed.
- *   Zero indicates that no limit should be enforced.
- *
- * @return
- *   An array. If the file size exceeds limits, it will contain an error
- *   message.
- *
- * @see hook_file_validate()
- */
-function file_validate_size(File $file, $file_limit = 0, $user_limit = 0) {
-  global $user;
-
-  $errors = array();
-
-  // Bypass validation for uid  = 1.
-  if ($user->uid != 1) {
-    if ($file_limit && $file->filesize > $file_limit) {
-      $errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize), '%maxsize' => format_size($file_limit)));
-    }
-
-    // Save a query by only calling file_space_used() when a limit is provided.
-    if ($user_limit && (file_space_used($user->uid) + $file->filesize) > $user_limit) {
-      $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->filesize), '%quota' => format_size($user_limit)));
-    }
-  }
-  return $errors;
-}
-
-/**
- * Checks that the file is recognized by image_get_info() as an image.
- *
- * @param Drupal\Core\File\File $file
- *   A file entity.
- *
- * @return
- *   An array. If the file is not an image, it will contain an error message.
- *
- * @see hook_file_validate()
- */
-function file_validate_is_image(File $file) {
-  $errors = array();
-
-  $info = image_get_info($file->uri);
-  if (!$info || empty($info['extension'])) {
-    $errors[] = t('Only JPEG, PNG and GIF images are allowed.');
-  }
-
-  return $errors;
-}
-
-/**
- * Verifies that image dimensions are within the specified maximum and minimum.
- *
- * Non-image files will be ignored. If a image toolkit is available the image
- * will be scaled to fit within the desired maximum dimensions.
- *
- * @param Drupal\Core\File\File $file
- *   A file entity. This function may resize the file affecting its size.
- * @param $maximum_dimensions
- *   An optional string in the form WIDTHxHEIGHT e.g. '640x480' or '85x85'. If
- *   an image toolkit is installed the image will be resized down to these
- *   dimensions. A value of 0 indicates no restriction on size, so resizing
- *   will be attempted.
- * @param $minimum_dimensions
- *   An optional string in the form WIDTHxHEIGHT. This will check that the
- *   image meets a minimum size. A value of 0 indicates no restriction.
- *
- * @return
- *   An array. If the file is an image and did not meet the requirements, it
- *   will contain an error message.
- *
- * @see hook_file_validate()
- */
-function file_validate_image_resolution(File $file, $maximum_dimensions = 0, $minimum_dimensions = 0) {
-  $errors = array();
-
-  // Check first that the file is an image.
-  if ($info = image_get_info($file->uri)) {
-    if ($maximum_dimensions) {
-      // Check that it is smaller than the given dimensions.
-      list($width, $height) = explode('x', $maximum_dimensions);
-      if ($info['width'] > $width || $info['height'] > $height) {
-        // Try to resize the image to fit the dimensions.
-        if ($image = image_load($file->uri)) {
-          image_scale($image, $width, $height);
-          image_save($image);
-          $file->filesize = $image->info['file_size'];
-          drupal_set_message(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $maximum_dimensions)));
-        }
-        else {
-          $errors[] = t('The image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => $maximum_dimensions));
-        }
-      }
-    }
-
-    if ($minimum_dimensions) {
-      // Check that it is larger than the given dimensions.
-      list($width, $height) = explode('x', $minimum_dimensions);
-      if ($info['width'] < $width || $info['height'] < $height) {
-        $errors[] = t('The image is too small; the minimum dimensions are %dimensions pixels.', array('%dimensions' => $minimum_dimensions));
-      }
-    }
-  }
-
-  return $errors;
-}
-
-/**
- * Saves a file to the specified destination and creates a database entry.
- *
- * @param $data
- *   A string containing the contents of the file.
- * @param $destination
- *   A string containing the destination URI. This must be a stream wrapper URI.
- *   If no value is provided, a randomized name will be generated and the file
- *   will be saved using Drupal's default files scheme, usually "public://".
- * @param $replace
- *   Replace behavior when the destination file already exists:
- *   - FILE_EXISTS_REPLACE - Replace the existing file. If a managed file with
- *       the destination name exists then its database entry will be updated. If
- *       no database entry is found then a new one will be created.
- *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is
- *       unique.
- *   - FILE_EXISTS_ERROR - Do nothing and return FALSE.
- *
- * @return Drupal\Core\File\File
- *   A file entity, or FALSE on error.
- *
- * @see file_unmanaged_save_data()
- */
-function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
-  global $user;
-
-  if (empty($destination)) {
-    $destination = file_default_scheme() . '://';
-  }
-  if (!file_valid_uri($destination)) {
-    watchdog('file', 'The data could not be saved because the destination %destination is invalid. This may be caused by improper use of file_save_data() or a missing stream wrapper.', array('%destination' => $destination));
-    drupal_set_message(t('The data could not be saved because the destination is invalid. More information is available in the system log.'), 'error');
-    return FALSE;
-  }
-
-  if ($uri = file_unmanaged_save_data($data, $destination, $replace)) {
-    // Create a file entity.
-    $file = entity_create('file', array(
-      'uri' => $uri,
-      'uid' => $user->uid,
-      'status' => FILE_STATUS_PERMANENT,
-    ));
-    // If we are replacing an existing file re-use its database record.
-    if ($replace == FILE_EXISTS_REPLACE) {
-      $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
-      if (count($existing_files)) {
-        $existing = reset($existing_files);
-        $file->fid = $existing->fid;
-        $file->filename = $existing->filename;
-      }
-    }
-    // If we are renaming around an existing file (rather than a directory),
-    // use its basename for the filename.
-    elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
-      $file->filename = drupal_basename($destination);
-    }
-
-    $file->save();
-    return $file;
-  }
-  return FALSE;
-}
-
-/**
  * Saves a file to the specified destination without invoking file API.
  *
  * This function is identical to file_save_data() except the file will not be
@@ -2443,36 +1859,5 @@ function file_directory_temp() {
 }
 
 /**
- * Examines a file entity and returns appropriate content headers for download.
- *
- * @param Drupal\Core\File\File $file
- *   A file entity.
- *
- * @return
- *   An associative array of headers, as expected by
- *   \Symfony\Component\HttpFoundation\StreamedResponse.
- */
-function file_get_content_headers(File $file) {
-  $name = mime_header_encode($file->filename);
-  $type = mime_header_encode($file->filemime);
-  // Serve images, text, and flash content for display rather than download.
-  $inline_types = variable_get('file_inline_types', array('^text/', '^image/', 'flash$'));
-  $disposition = 'attachment';
-  foreach ($inline_types as $inline_type) {
-    // Exclamation marks are used as delimiters to avoid escaping slashes.
-    if (preg_match('!' . $inline_type . '!', $file->filemime)) {
-      $disposition = 'inline';
-    }
-  }
-
-  return array(
-    'Content-Type' => $type . '; name="' . $name . '"',
-    'Content-Length' => $file->filesize,
-    'Content-Disposition' => $disposition . '; filename="' . $name . '"',
-    'Cache-Control' => 'private',
-  );
-}
-
-/**
  * @} End of "defgroup file".
  */
diff --git a/core/modules/aggregator/aggregator.info b/core/modules/aggregator/aggregator.info
index c45fa82..5954a87 100644
--- a/core/modules/aggregator/aggregator.info
+++ b/core/modules/aggregator/aggregator.info
@@ -5,3 +5,4 @@ version = VERSION
 core = 8.x
 configure = admin/config/services/aggregator/settings
 stylesheets[all][] = aggregator.theme.css
+dependencies[] = file
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 5db5442..237f94f 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -10,7 +10,7 @@
  */
 
 use Drupal\node\Node;
-use Drupal\Core\File\File;
+use Drupal\file\File;
 use Drupal\entity\EntityInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityCrudHookTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityCrudHookTest.php
index 5f7f577..251dd3c 100644
--- a/core/modules/entity/lib/Drupal/entity/Tests/EntityCrudHookTest.php
+++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityCrudHookTest.php
@@ -28,7 +28,7 @@ class EntityCrudHookTest extends WebTestBase {
    *
    * @var array
    */
-  public static $modules = array('entity_crud_hook_test', 'taxonomy', 'comment');
+  public static $modules = array('entity_crud_hook_test', 'taxonomy', 'comment', 'file');
 
   protected $ids = array();
 
diff --git a/core/modules/file/file.api.php b/core/modules/file/file.api.php
index 71039b1..5585855 100644
--- a/core/modules/file/file.api.php
+++ b/core/modules/file/file.api.php
@@ -5,6 +5,164 @@
  * Hooks for file module.
  */
 
+
+/**
+ * Load additional information into file entities.
+ *
+ * file_load_multiple() calls this hook to allow modules to load
+ * additional information into each file.
+ *
+ * @param $files
+ *   An array of file entities, indexed by fid.
+ *
+ * @see file_load_multiple()
+ * @see file_load()
+ */
+function hook_file_load($files) {
+  // Add the upload specific data into the file entity.
+  $result = db_query('SELECT * FROM {upload} u WHERE u.fid IN (:fids)', array(':fids' => array_keys($files)))->fetchAll(PDO::FETCH_ASSOC);
+  foreach ($result as $record) {
+    foreach ($record as $key => $value) {
+      $files[$record['fid']]->$key = $value;
+    }
+  }
+}
+
+/**
+ * Check that files meet a given criteria.
+ *
+ * This hook lets modules perform additional validation on files. They're able
+ * to report a failure by returning one or more error messages.
+ *
+ * @param Drupal\file\File $file
+ *   The file entity being validated.
+ * @return
+ *   An array of error messages. If there are no problems with the file return
+ *   an empty array.
+ *
+ * @see file_validate()
+ */
+function hook_file_validate(Drupal\file\File $file) {
+  $errors = array();
+
+  if (empty($file->filename)) {
+    $errors[] = t("The file's name is empty. Please give a name to the file.");
+  }
+  if (strlen($file->filename) > 255) {
+    $errors[] = t("The file's name exceeds the 255 characters limit. Please rename the file and try again.");
+  }
+
+  return $errors;
+}
+
+/**
+ * Act on a file being inserted or updated.
+ *
+ * This hook is called when a file has been added to the database. The hook
+ * doesn't distinguish between files created as a result of a copy or those
+ * created by an upload.
+ *
+ * @param Drupal\file\File $file
+ *   The file entity that is about to be created or updated.
+ */
+function hook_file_presave(Drupal\file\File $file) {
+  // Change the file timestamp to an hour prior.
+  $file->timestamp -= 3600;
+}
+
+/**
+ * Respond to a file being added.
+ *
+ * This hook is called after a file has been added to the database. The hook
+ * doesn't distinguish between files created as a result of a copy or those
+ * created by an upload.
+ *
+ * @param Drupal\file\File $file
+ *   The file that has been added.
+ */
+function hook_file_insert(Drupal\file\File $file) {
+  // Add a message to the log, if the file is a jpg
+  $validate = file_validate_extensions($file, 'jpg');
+  if (empty($validate)) {
+    watchdog('file', 'A jpg has been added.');
+  }
+}
+
+/**
+ * Respond to a file being updated.
+ *
+ * This hook is called when an existing file is saved.
+ *
+ * @param Drupal\file\File $file
+ *   The file that has just been updated.
+ */
+function hook_file_update(Drupal\file\File $file) {
+
+}
+
+/**
+ * Respond to a file that has been copied.
+ *
+ * @param Drupal\file\File $file
+ *   The newly copied file entity.
+ * @param Drupal\file\File $source
+ *   The original file before the copy.
+ *
+ * @see file_copy()
+ */
+function hook_file_copy(Drupal\file\File $file, Drupal\file\File $source) {
+
+}
+
+/**
+ * Respond to a file that has been moved.
+ *
+ * @param Drupal\file\File $file
+ *   The updated file entity after the move.
+ * @param Drupal\file\File $source
+ *   The original file entity before the move.
+ *
+ * @see file_move()
+ */
+function hook_file_move(Drupal\file\File $file, Drupal\file\File $source) {
+
+}
+
+/**
+ * Act prior to file deletion.
+ *
+ * This hook is invoked when deleting a file before the file is removed from the
+ * filesystem and before its records are removed from the database.
+ *
+ * @param Drupal\file\File $file
+ *   The file that is about to be deleted.
+ *
+ * @see hook_file_delete()
+ * @see Drupal\file\FileStorageController::delete()
+ * @see upload_file_delete()
+ */
+function hook_file_predelete(Drupal\file\File $file) {
+  // Delete all information associated with the file.
+  db_delete('upload')->condition('fid', $file->fid)->execute();
+}
+
+/**
+ * Respond to file deletion.
+ *
+ * This hook is invoked after the file has been removed from
+ * the filesystem and after its records have been removed from the database.
+ *
+ * @param Drupal\file\File $file
+ *   The file that has just been deleted.
+ *
+ * @see hook_file_predelete()
+ * @see Drupal\file\FileStorageController::delete()
+ */
+function hook_file_delete(Drupal\file\File $file) {
+  // Delete all information associated with the file.
+  db_delete('upload')->condition('fid', $file->fid)->execute();
+}
+
 /**
  * Control download access to files.
  *
@@ -16,7 +174,7 @@
  *   The field to which the file belongs.
  * @param Drupal\entity\EntityInterface $entity
  *   The entity which references the file.
- * @param Drupal\Core\File\File $file
+ * @param Drupal\file\File $file
  *   The file entity that is being requested.
  *
  * @return
@@ -26,7 +184,7 @@
  *
  * @see hook_field_access().
  */
-function hook_file_download_access($field, Drupal\entity\EntityInterface $entity, Drupal\Core\File\File $file) {
+function hook_file_download_access($field, Drupal\entity\EntityInterface $entity, Drupal\file\File $file) {
   if ($entity->entityType() == 'node') {
     return node_access('view', $entity);
   }
diff --git a/core/modules/file/file.install b/core/modules/file/file.install
index 170075c..fde41d3 100644
--- a/core/modules/file/file.install
+++ b/core/modules/file/file.install
@@ -6,6 +6,150 @@
  */
 
 /**
+ * Implements hook_schema().
+ */
+function file_schema() {
+  $schema['file_managed'] = array(
+    'description' => 'Stores information for uploaded files.',
+    'fields' => array(
+      'fid' => array(
+        'description' => 'File ID.',
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'uuid' => array(
+        'description' => 'Unique Key: Universally unique identifier for this entity.',
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => FALSE,
+      ),
+      'uid' => array(
+        'description' => 'The {users}.uid of the user who is associated with the file.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'filename' => array(
+        'description' => 'Name of the file with no path components. This may differ from the basename of the URI if the file is renamed to avoid overwriting an existing file.',
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => '',
+        'binary' => TRUE,
+      ),
+      'uri' => array(
+        'description' => 'The URI to access the file (either local or remote).',
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => '',
+        'binary' => TRUE,
+      ),
+      'langcode' => array(
+        'description' => 'The {language}.langcode of this file.',
+        'type' => 'varchar',
+        'length' => 12,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'filemime' => array(
+        'description' => "The file's MIME type.",
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'filesize' => array(
+        'description' => 'The size of the file in bytes.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'status' => array(
+        'description' => 'A field indicating the status of the file. Two status are defined in core: temporary (0) and permanent (1). Temporary files older than DRUPAL_MAXIMUM_TEMP_FILE_AGE will be removed during a cron run.',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+        'size' => 'tiny',
+      ),
+      'timestamp' => array(
+        'description' => 'UNIX timestamp for when the file was added.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'indexes' => array(
+      'uid' => array('uid'),
+      'status' => array('status'),
+      'timestamp' => array('timestamp'),
+    ),
+    'unique keys' => array(
+      'uuid' => array('uuid'),
+      'uri' => array('uri'),
+    ),
+    'primary key' => array('fid'),
+    'foreign keys' => array(
+      'file_owner' => array(
+        'table' => 'users',
+        'columns' => array('uid' => 'uid'),
+      ),
+    ),
+  );
+
+  $schema['file_usage'] = array(
+    'description' => 'Track where a file is used.',
+    'fields' => array(
+      'fid' => array(
+        'description' => 'File ID.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'module' => array(
+        'description' => 'The name of the module that is using the file.',
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'type' => array(
+        'description' => 'The name of the object type in which the file is used.',
+        'type' => 'varchar',
+        'length' => 64,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'id' => array(
+        'description' => 'The primary key of the object using the file.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'count' => array(
+        'description' => 'The number of times this file is used by this object.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('fid', 'type', 'id', 'module'),
+    'indexes' => array(
+      'type_id' => array('type', 'id'),
+      'fid_count' => array('fid', 'count'),
+      'fid_module' => array('fid', 'module'),
+    ),
+  );
+  return $schema;
+}
+
+/**
  * Implements hook_field_schema().
  */
 function file_field_schema($field) {
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index d2f6f76..1f3d029 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -6,7 +6,7 @@
  */
 
 use Drupal\entity\EntityFieldQuery;
-use Drupal\Core\File\File;
+use Drupal\file\File;
 use Symfony\Component\HttpFoundation\JsonResponse;
 
 // Load all Field module hooks for File.
@@ -86,6 +86,638 @@ function file_element_info() {
 }
 
 /**
+ * Implements hook_entity_info().
+ */
+function file_entity_info() {
+  return array(
+    'file' => array(
+      'label' => t('File'),
+      'base table' => 'file_managed',
+      'controller class' => 'Drupal\file\FileStorageController',
+      'entity class' => 'Drupal\file\File',
+      'entity keys' => array(
+        'id' => 'fid',
+        'label' => 'filename',
+        'uuid' => 'uuid',
+      ),
+      'static cache' => FALSE,
+    ),
+  );
+}
+/**
+ * Loads file entities from the database.
+ *
+ * @param array $fids
+ *   (optional) An array of entity IDs. If omitted, all entities are loaded.
+ *
+ * @return array
+ *   An array of file entities, indexed by fid.
+ *
+ * @see hook_file_load()
+ * @see file_load()
+ * @see entity_load()
+ * @see Drupal\entity\EntityFieldQuery
+ */
+function file_load_multiple(array $fids = NULL) {
+  return entity_load_multiple('file', $fids);
+}
+
+/**
+ * Loads a single file entity from the database.
+ *
+ * @param $fid
+ *   A file ID.
+ *
+ * @return Drupal\file\File
+ *   A file entity or FALSE if the file was not found.
+ *
+ * @see hook_file_load()
+ * @see file_load_multiple()
+ */
+function file_load($fid) {
+  $files = file_load_multiple(array($fid));
+  return reset($files);
+}
+
+/**
+ * Determines where a file is used.
+ *
+ * @param Drupal\file\File $file
+ *   A file entity.
+ *
+ * @return
+ *   A nested array with usage data. The first level is keyed by module name,
+ *   the second by object type and the third by the object id. The value
+ *   of the third level contains the usage count.
+ *
+ * @see file_usage_add()
+ * @see file_usage_delete()
+ */
+function file_usage_list(File $file) {
+  $result = db_select('file_usage', 'f')
+    ->fields('f', array('module', 'type', 'id', 'count'))
+    ->condition('fid', $file->fid)
+    ->condition('count', 0, '>')
+    ->execute();
+  $references = array();
+  foreach ($result as $usage) {
+    $references[$usage->module][$usage->type][$usage->id] = $usage->count;
+  }
+  return $references;
+}
+
+/**
+ * Records that a module is using a file.
+ *
+ * Examples:
+ * - A module that associates files with nodes, so $type would be
+ *   'node' and $id would be the node's nid. Files for all revisions are stored
+ *   within a single nid.
+ * - The User module associates an image with a user, so $type would be 'user'
+ *   and the $id would be the user's uid.
+ *
+ * @param Drupal\file\File $file
+ *   A file entity.
+ * @param $module
+ *   The name of the module using the file.
+ * @param $type
+ *   The type of the object that contains the referenced file.
+ * @param $id
+ *   The unique, numeric ID of the object containing the referenced file.
+ * @param $count
+ *   (optional) The number of references to add to the object. Defaults to 1.
+ *
+ * @see file_usage_list()
+ * @see file_usage_delete()
+ */
+function file_usage_add(File $file, $module, $type, $id, $count = 1) {
+  db_merge('file_usage')
+    ->key(array(
+      'fid' => $file->fid,
+      'module' => $module,
+      'type' => $type,
+      'id' => $id,
+    ))
+    ->fields(array('count' => $count))
+    ->expression('count', 'count + :count', array(':count' => $count))
+    ->execute();
+
+  // Make sure that a used file is permament.
+  if ($file->status != FILE_STATUS_PERMANENT) {
+    $file->status = FILE_STATUS_PERMANENT;
+    $file->save();
+  }
+}
+
+/**
+ * Removes a record to indicate that a module is no longer using a file.
+ *
+ * @param Drupal\file\File $file
+ *   A file entity.
+ * @param $module
+ *   The name of the module using the file.
+ * @param $type
+ *   (optional) The type of the object that contains the referenced file. May
+ *   be omitted if all module references to a file are being deleted.
+ * @param $id
+ *   (optional) The unique, numeric ID of the object containing the referenced
+ *   file. May be omitted if all module references to a file are being deleted.
+ * @param $count
+ *   (optional) The number of references to delete from the object. Defaults to
+ *   1. 0 may be specified to delete all references to the file within a
+ *   specific object.
+ *
+ * @see file_usage_add()
+ * @see file_usage_list()
+ */
+function file_usage_delete(File $file, $module, $type = NULL, $id = NULL, $count = 1) {
+  // Delete rows that have a exact or less value to prevent empty rows.
+  $query = db_delete('file_usage')
+    ->condition('module', $module)
+    ->condition('fid', $file->fid);
+  if ($type && $id) {
+    $query
+      ->condition('type', $type)
+      ->condition('id', $id);
+  }
+  if ($count) {
+    $query->condition('count', $count, '<=');
+  }
+  $result = $query->execute();
+
+  // If the row has more than the specified count decrement it by that number.
+  if (!$result && $count > 0) {
+    $query = db_update('file_usage')
+      ->condition('module', $module)
+      ->condition('fid', $file->fid);
+    if ($type && $id) {
+      $query
+        ->condition('type', $type)
+        ->condition('id', $id);
+    }
+    $query->expression('count', 'count - :count', array(':count' => $count));
+    $query->execute();
+  }
+
+  // If there are no more remaining usages of this file, mark it as temporary,
+  // which result in a delete through system_cron().
+  $usage = file_usage_list($file);
+  if (empty($usage)) {
+    $file->status = 0;
+    $file->save();
+  }
+}
+
+/**
+ * Copies a file to a new location and adds a file record to the database.
+ *
+ * This function should be used when manipulating files that have records
+ * stored in the database. This is a powerful function that in many ways
+ * performs like an advanced version of copy().
+ * - Checks if $source and $destination are valid and readable/writable.
+ * - Checks that $source is not equal to $destination; if they are an error
+ *   is reported.
+ * - If file already exists in $destination either the call will error out,
+ *   replace the file or rename the file based on the $replace parameter.
+ * - Adds the new file to the files database. If the source file is a
+ *   temporary file, the resulting file will also be a temporary file. See
+ *   file_save_upload() for details on temporary files.
+ *
+ * @param Drupal\file\File $source
+ *   A file entity.
+ * @param $destination
+ *   A string containing the destination that $source should be copied to.
+ *   This must be a stream wrapper URI.
+ * @param $replace
+ *   Replace behavior when the destination file already exists:
+ *   - FILE_EXISTS_REPLACE - Replace the existing file. If a managed file with
+ *       the destination name exists then its database entry will be updated. If
+ *       no database entry is found then a new one will be created.
+ *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is
+ *       unique.
+ *   - FILE_EXISTS_ERROR - Do nothing and return FALSE.
+ *
+ * @return
+ *   File object if the copy is successful, or FALSE in the event of an error.
+ *
+ * @see file_unmanaged_copy()
+ * @see hook_file_copy()
+ */
+function file_copy(File $source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
+  if (!file_valid_uri($destination)) {
+    if (($realpath = drupal_realpath($source->uri)) !== FALSE) {
+      watchdog('file', 'File %file (%realpath) could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->uri, '%realpath' => $realpath, '%destination' => $destination));
+    }
+    else {
+      watchdog('file', 'File %file could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->uri, '%destination' => $destination));
+    }
+    drupal_set_message(t('The specified file %file could not be copied because the destination is invalid. More information is available in the system log.', array('%file' => $source->uri)), 'error');
+    return FALSE;
+  }
+
+  if ($uri = file_unmanaged_copy($source->uri, $destination, $replace)) {
+    $file = clone $source;
+    $file->fid = NULL;
+    $file->uri = $uri;
+    $file->filename = drupal_basename($uri);
+    // If we are replacing an existing file re-use its database record.
+    if ($replace == FILE_EXISTS_REPLACE) {
+      $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
+      if (count($existing_files)) {
+        $existing = reset($existing_files);
+        $file->fid = $existing->fid;
+        $file->filename = $existing->filename;
+      }
+    }
+    // If we are renaming around an existing file (rather than a directory),
+    // use its basename for the filename.
+    elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
+      $file->filename = drupal_basename($destination);
+    }
+
+    $file->save();
+
+    // Inform modules that the file has been copied.
+    module_invoke_all('file_copy', $file, $source);
+
+    return $file;
+  }
+  return FALSE;
+}
+
+/**
+ * Moves a file to a new location and update the file's database entry.
+ *
+ * Moving a file is performed by copying the file to the new location and then
+ * deleting the original.
+ * - Checks if $source and $destination are valid and readable/writable.
+ * - Performs a file move if $source is not equal to $destination.
+ * - If file already exists in $destination either the call will error out,
+ *   replace the file or rename the file based on the $replace parameter.
+ * - Adds the new file to the files database.
+ *
+ * @param Drupal\file\File $source
+ *   A file entity.
+ * @param $destination
+ *   A string containing the destination that $source should be moved to.
+ *   This must be a stream wrapper URI.
+ * @param $replace
+ *   Replace behavior when the destination file already exists:
+ *   - FILE_EXISTS_REPLACE - Replace the existing file. If a managed file with
+ *       the destination name exists then its database entry will be updated and
+ *       $source->delete() called after invoking hook_file_move().
+ *       If no database entry is found then the source files record will be
+ *       updated.
+ *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is
+ *       unique.
+ *   - FILE_EXISTS_ERROR - Do nothing and return FALSE.
+ *
+ * @return Drupal\file\File
+ *   Resulting file entity for success, or FALSE in the event of an error.
+ *
+ * @see file_unmanaged_move()
+ * @see hook_file_move()
+ */
+function file_move(File $source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
+  if (!file_valid_uri($destination)) {
+    if (($realpath = drupal_realpath($source->uri)) !== FALSE) {
+      watchdog('file', 'File %file (%realpath) could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->uri, '%realpath' => $realpath, '%destination' => $destination));
+    }
+    else {
+      watchdog('file', 'File %file could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->uri, '%destination' => $destination));
+    }
+    drupal_set_message(t('The specified file %file could not be moved because the destination is invalid. More information is available in the system log.', array('%file' => $source->uri)), 'error');
+    return FALSE;
+  }
+
+  if ($uri = file_unmanaged_move($source->uri, $destination, $replace)) {
+    $delete_source = FALSE;
+
+    $file = clone $source;
+    $file->uri = $uri;
+    // If we are replacing an existing file re-use its database record.
+    if ($replace == FILE_EXISTS_REPLACE) {
+      $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
+      if (count($existing_files)) {
+        $existing = reset($existing_files);
+        $delete_source = TRUE;
+        $file->fid = $existing->fid;
+      }
+    }
+    // If we are renaming around an existing file (rather than a directory),
+    // use its basename for the filename.
+    elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
+      $file->filename = drupal_basename($destination);
+    }
+
+    $file->save();
+
+    // Inform modules that the file has been moved.
+    module_invoke_all('file_move', $file, $source);
+
+    // Delete the original if it's not in use elsewhere.
+    if ($delete_source && !file_usage_list($source)) {
+      $source->delete();
+    }
+
+    return $file;
+  }
+  return FALSE;
+}
+
+/**
+ * Checks that a file meets the criteria specified by the validators.
+ *
+ * After executing the validator callbacks specified hook_file_validate() will
+ * also be called to allow other modules to report errors about the file.
+ *
+ * @param Drupal\file\File $file
+ *   A file entity.
+ * @param $validators
+ *   An optional, associative array of callback functions used to validate the
+ *   file. The keys are function names and the values arrays of callback
+ *   parameters which will be passed in after the file entity. The
+ *   functions should return an array of error messages; an empty array
+ *   indicates that the file passed validation. The functions will be called in
+ *   the order specified.
+ *
+ * @return
+ *   An array containing validation error messages.
+ *
+ * @see hook_file_validate()
+ */
+function file_validate(File $file, $validators = array()) {
+  // Call the validation functions specified by this function's caller.
+  $errors = array();
+  foreach ($validators as $function => $args) {
+    if (function_exists($function)) {
+      array_unshift($args, $file);
+      $errors = array_merge($errors, call_user_func_array($function, $args));
+    }
+  }
+
+  // Let other modules perform validation on the new file.
+  return array_merge($errors, module_invoke_all('file_validate', $file));
+}
+
+/**
+ * Checks for files with names longer than can be stored in the database.
+ *
+ * @param Drupal\file\File $file
+ *   A file entity.
+ *
+ * @return
+ *   An array. If the file name is too long, it will contain an error message.
+ */
+function file_validate_name_length(File $file) {
+  $errors = array();
+
+  if (empty($file->filename)) {
+    $errors[] = t("The file's name is empty. Please give a name to the file.");
+  }
+  if (strlen($file->filename) > 240) {
+    $errors[] = t("The file's name exceeds the 240 characters limit. Please rename the file and try again.");
+  }
+  return $errors;
+}
+
+/**
+ * Checks that the filename ends with an allowed extension.
+ *
+ * @param Drupal\file\File $file
+ *   A file entity.
+ * @param $extensions
+ *   A string with a space separated list of allowed extensions.
+ *
+ * @return
+ *   An array. If the file extension is not allowed, it will contain an error
+ *   message.
+ *
+ * @see hook_file_validate()
+ */
+function file_validate_extensions(File $file, $extensions) {
+  $errors = array();
+
+  $regex = '/\.(' . preg_replace('/ +/', '|', preg_quote($extensions)) . ')$/i';
+  if (!preg_match($regex, $file->filename)) {
+    $errors[] = t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => $extensions));
+  }
+  return $errors;
+}
+
+/**
+ * Checks that the file's size is below certain limits.
+ *
+ * This check is not enforced for the user #1.
+ *
+ * @param Drupal\file\File $file
+ *   A file entity.
+ * @param $file_limit
+ *   An integer specifying the maximum file size in bytes. Zero indicates that
+ *   no limit should be enforced.
+ * @param $user_limit
+ *   An integer specifying the maximum number of bytes the user is allowed.
+ *   Zero indicates that no limit should be enforced.
+ *
+ * @return
+ *   An array. If the file size exceeds limits, it will contain an error
+ *   message.
+ *
+ * @see hook_file_validate()
+ */
+function file_validate_size(File $file, $file_limit = 0, $user_limit = 0) {
+  global $user;
+
+  $errors = array();
+
+  // Bypass validation for uid  = 1.
+  if ($user->uid != 1) {
+    if ($file_limit && $file->filesize > $file_limit) {
+      $errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize), '%maxsize' => format_size($file_limit)));
+    }
+
+    // Save a query by only calling file_space_used() when a limit is provided.
+    if ($user_limit && (file_space_used($user->uid) + $file->filesize) > $user_limit) {
+      $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->filesize), '%quota' => format_size($user_limit)));
+    }
+  }
+  return $errors;
+}
+
+/**
+ * Checks that the file is recognized by image_get_info() as an image.
+ *
+ * @param Drupal\file\File $file
+ *   A file entity.
+ *
+ * @return
+ *   An array. If the file is not an image, it will contain an error message.
+ *
+ * @see hook_file_validate()
+ */
+function file_validate_is_image(File $file) {
+  $errors = array();
+
+  $info = image_get_info($file->uri);
+  if (!$info || empty($info['extension'])) {
+    $errors[] = t('Only JPEG, PNG and GIF images are allowed.');
+  }
+
+  return $errors;
+}
+
+/**
+ * Verifies that image dimensions are within the specified maximum and minimum.
+ *
+ * Non-image files will be ignored. If a image toolkit is available the image
+ * will be scaled to fit within the desired maximum dimensions.
+ *
+ * @param Drupal\file\File $file
+ *   A file entity. This function may resize the file affecting its size.
+ * @param $maximum_dimensions
+ *   An optional string in the form WIDTHxHEIGHT e.g. '640x480' or '85x85'. If
+ *   an image toolkit is installed the image will be resized down to these
+ *   dimensions. A value of 0 indicates no restriction on size, so resizing
+ *   will be attempted.
+ * @param $minimum_dimensions
+ *   An optional string in the form WIDTHxHEIGHT. This will check that the
+ *   image meets a minimum size. A value of 0 indicates no restriction.
+ *
+ * @return
+ *   An array. If the file is an image and did not meet the requirements, it
+ *   will contain an error message.
+ *
+ * @see hook_file_validate()
+ */
+function file_validate_image_resolution(File $file, $maximum_dimensions = 0, $minimum_dimensions = 0) {
+  $errors = array();
+
+  // Check first that the file is an image.
+  if ($info = image_get_info($file->uri)) {
+    if ($maximum_dimensions) {
+      // Check that it is smaller than the given dimensions.
+      list($width, $height) = explode('x', $maximum_dimensions);
+      if ($info['width'] > $width || $info['height'] > $height) {
+        // Try to resize the image to fit the dimensions.
+        if ($image = image_load($file->uri)) {
+          image_scale($image, $width, $height);
+          image_save($image);
+          $file->filesize = $image->info['file_size'];
+          drupal_set_message(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $maximum_dimensions)));
+        }
+        else {
+          $errors[] = t('The image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => $maximum_dimensions));
+        }
+      }
+    }
+
+    if ($minimum_dimensions) {
+      // Check that it is larger than the given dimensions.
+      list($width, $height) = explode('x', $minimum_dimensions);
+      if ($info['width'] < $width || $info['height'] < $height) {
+        $errors[] = t('The image is too small; the minimum dimensions are %dimensions pixels.', array('%dimensions' => $minimum_dimensions));
+      }
+    }
+  }
+
+  return $errors;
+}
+
+/**
+ * Saves a file to the specified destination and creates a database entry.
+ *
+ * @param $data
+ *   A string containing the contents of the file.
+ * @param $destination
+ *   A string containing the destination URI. This must be a stream wrapper URI.
+ *   If no value is provided, a randomized name will be generated and the file
+ *   will be saved using Drupal's default files scheme, usually "public://".
+ * @param $replace
+ *   Replace behavior when the destination file already exists:
+ *   - FILE_EXISTS_REPLACE - Replace the existing file. If a managed file with
+ *       the destination name exists then its database entry will be updated. If
+ *       no database entry is found then a new one will be created.
+ *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is
+ *       unique.
+ *   - FILE_EXISTS_ERROR - Do nothing and return FALSE.
+ *
+ * @return Drupal\file\File
+ *   A file entity, or FALSE on error.
+ *
+ * @see file_unmanaged_save_data()
+ */
+function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
+  global $user;
+
+  if (empty($destination)) {
+    $destination = file_default_scheme() . '://';
+  }
+  if (!file_valid_uri($destination)) {
+    watchdog('file', 'The data could not be saved because the destination %destination is invalid. This may be caused by improper use of file_save_data() or a missing stream wrapper.', array('%destination' => $destination));
+    drupal_set_message(t('The data could not be saved because the destination is invalid. More information is available in the system log.'), 'error');
+    return FALSE;
+  }
+
+  if ($uri = file_unmanaged_save_data($data, $destination, $replace)) {
+    // Create a file entity.
+    $file = entity_create('file', array(
+      'uri' => $uri,
+      'uid' => $user->uid,
+      'status' => FILE_STATUS_PERMANENT,
+    ));
+    // If we are replacing an existing file re-use its database record.
+    if ($replace == FILE_EXISTS_REPLACE) {
+      $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
+      if (count($existing_files)) {
+        $existing = reset($existing_files);
+        $file->fid = $existing->fid;
+        $file->filename = $existing->filename;
+      }
+    }
+    // If we are renaming around an existing file (rather than a directory),
+    // use its basename for the filename.
+    elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
+      $file->filename = drupal_basename($destination);
+    }
+
+    $file->save();
+    return $file;
+  }
+  return FALSE;
+}
+
+/**
+ * Examines a file entity and returns appropriate content headers for download.
+ *
+ * @param Drupal\file\File $file
+ *   A file entity.
+ *
+ * @return
+ *   An associative array of headers, as expected by
+ *   \Symfony\Component\HttpFoundation\StreamedResponse.
+ */
+function file_get_content_headers(File $file) {
+  $name = mime_header_encode($file->filename);
+  $type = mime_header_encode($file->filemime);
+  // Serve images, text, and flash content for display rather than download.
+  $inline_types = variable_get('file_inline_types', array('^text/', '^image/', 'flash$'));
+  $disposition = 'attachment';
+  foreach ($inline_types as $inline_type) {
+    // Exclamation marks are used as delimiters to avoid escaping slashes.
+    if (preg_match('!' . $inline_type . '!', $file->filemime)) {
+      $disposition = 'inline';
+    }
+  }
+
+  return array(
+    'Content-Type' => $type . '; name="' . $name . '"',
+    'Content-Length' => $file->filesize,
+    'Content-Disposition' => $disposition . '; filename="' . $name . '"',
+    'Cache-Control' => 'private',
+  );
+}
+
+/**
  * Implements hook_theme().
  */
 function file_theme() {
@@ -235,6 +867,35 @@ function file_file_download($uri, $field_type = 'file') {
 }
 
 /**
+ * Implements file_cron()
+ */
+function file_cron() {
+  // Remove temporary files that are older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
+  // Use separate placeholders for the status to avoid a bug in some versions
+  // of PHP. See http://drupal.org/node/352956.
+  $result = db_query('SELECT fid FROM {file_managed} WHERE status <> :permanent AND timestamp < :timestamp', array(
+    ':permanent' => FILE_STATUS_PERMANENT,
+    ':timestamp' => REQUEST_TIME - DRUPAL_MAXIMUM_TEMP_FILE_AGE
+  ));
+  foreach ($result as $row) {
+    if ($file = file_load($row->fid)) {
+      $references = file_usage_list($file);
+      if (empty($references)) {
+        if (file_exists($file->uri)) {
+          $file->delete();
+        }
+        else {
+          watchdog('file system', 'Could not delete temporary file "%path" during garbage collection', array('%path' => $file->uri), WATCHDOG_ERROR);
+        }
+      }
+      else {
+        watchdog('file system', 'Did not delete temporary file "%path" during garbage collection because it is in use by the following modules: %modules.', array('%path' => $file->uri, '%modules' => implode(', ', array_keys($references))), WATCHDOG_INFO);
+      }
+    }
+  }
+}
+
+/**
  * Ajax callback: Processes file uploads and deletions.
  *
  * This rebuilds the form element for a particular field item. As long as the
@@ -791,7 +1452,7 @@ function theme_file_icon($variables) {
 /**
  * Creates a URL to the icon for a file entity.
  *
- * @param Drupal\Core\File\File $file
+ * @param Drupal\file\File $file
  *   A file entity.
  * @param $icon_directory
  *   (optional) A path to a directory of icons to be used for files. Defaults to
@@ -810,7 +1471,7 @@ function file_icon_url(File $file, $icon_directory = NULL) {
 /**
  * Creates a path to the icon for a file entity.
  *
- * @param Drupal\Core\File\File $file
+ * @param Drupal\file\File $file
  *   A file entity.
  * @param $icon_directory
  *   (optional) A path to a directory of icons to be used for files. Defaults to
@@ -863,7 +1524,7 @@ function file_icon_path(File $file, $icon_directory = NULL) {
 /**
  * Determines the generic icon MIME package based on a file's MIME type.
  *
- * @param Drupal\Core\File\File $file
+ * @param Drupal\file\File $file
  *   A file entity.
  *
  * @return
@@ -995,7 +1656,7 @@ function file_icon_map(File $file) {
 /**
  * Retrieves a list of references to a file.
  *
- * @param Drupal\Core\File\File $file
+ * @param Drupal\file\File $file
  *   A file entity.
  * @param $field
  *   (optional) A field array to be used for this check. If given, limits the
diff --git a/core/lib/Drupal/Core/File/File.php b/core/modules/file/lib/Drupal/file/File.php
similarity index 95%
rename from core/lib/Drupal/Core/File/File.php
rename to core/modules/file/lib/Drupal/file/File.php
index 2e5e67d..e70e3d0 100644
--- a/core/lib/Drupal/Core/File/File.php
+++ b/core/modules/file/lib/Drupal/file/File.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Definition of Drupal\Core\File\File.
+ * Definition of Drupal\file\File.
  */
 
-namespace Drupal\Core\File;
+namespace Drupal\file;
 
 use Drupal\entity\Entity;
 
diff --git a/core/lib/Drupal/Core/File/FileStorageController.php b/core/modules/file/lib/Drupal/file/FileStorageController.php
similarity index 95%
rename from core/lib/Drupal/Core/File/FileStorageController.php
rename to core/modules/file/lib/Drupal/file/FileStorageController.php
index 940e1fd..356e5c4 100644
--- a/core/lib/Drupal/Core/File/FileStorageController.php
+++ b/core/modules/file/lib/Drupal/file/FileStorageController.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Definition of Drupal\Core\File\FileStorageController.
+ * Definition of Drupal\file\FileStorageController.
  */
 
-namespace Drupal\Core\File;
+namespace Drupal\file;
 
 use Drupal\entity\DatabaseStorageController;
 use Drupal\entity\EntityInterface;
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/CopyTest.php b/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
similarity index 97%
rename from core/modules/system/lib/Drupal/system/Tests/File/CopyTest.php
rename to core/modules/file/lib/Drupal/file/Tests/CopyTest.php
index 70f7493..7f20c9f 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/CopyTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
@@ -2,15 +2,15 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\CopyTest.
+ * Definition of Drupal\file\Tests\CopyTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  * Copy related tests.
  */
-class CopyTest extends FileHookTestBase {
+class CopyTest extends FileManagedTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File copying',
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/DeleteTest.php b/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php
similarity index 95%
rename from core/modules/system/lib/Drupal/system/Tests/File/DeleteTest.php
rename to core/modules/file/lib/Drupal/file/Tests/DeleteTest.php
index 2691806..be2f8a4 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/DeleteTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php
@@ -2,15 +2,15 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\DeleteTest.
+ * Definition of Drupal\file\Tests\DeleteTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  * Deletion related tests.
  */
-class DeleteTest extends FileHookTestBase {
+class DeleteTest extends FileManagedTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File delete',
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/DownloadTest.php b/core/modules/file/lib/Drupal/file/Tests/DownloadTest.php
similarity index 96%
rename from core/modules/system/lib/Drupal/system/Tests/File/DownloadTest.php
rename to core/modules/file/lib/Drupal/file/Tests/DownloadTest.php
index a2bc1e5..0763507 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/DownloadTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/DownloadTest.php
@@ -2,23 +2,15 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\DownloadTest.
+ * Definition of Drupal\file\Tests\DownloadTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  * Tests for download/file transfer functions.
  */
-class DownloadTest extends FileTestBase {
-
-  /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('file_test');
-
+class DownloadTest extends FileManagedTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File download',
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/FileHookTestBase.php b/core/modules/file/lib/Drupal/file/Tests/FileManagedTestBase.php
similarity index 64%
rename from core/modules/system/lib/Drupal/system/Tests/File/FileHookTestBase.php
rename to core/modules/file/lib/Drupal/file/Tests/FileManagedTestBase.php
index cde558d..b449f8f 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/FileHookTestBase.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileManagedTestBase.php
@@ -2,26 +2,28 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\FileHookTestBase.
+ * Definition of Drupal\file\Tests\FileManagedTestBase.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
+
+use Drupal\system\Tests\File\FileTestBase;
+use \stdClass;
 
 /**
  * Base class for file tests that use the file_test module to test uploads and
  * hooks.
  */
-abstract class FileHookTestBase extends FileTestBase {
+abstract class FileManagedTestBase extends FileTestBase {
 
   /**
    * Modules to enable.
    *
    * @var array
    */
-  public static $modules = array('file_test');
+  public static $modules = array('file_test', 'file');
 
   function setUp() {
-    // Install file_test module
     parent::setUp();
     // Clear out any hook calls.
     file_test_reset();
@@ -84,4 +86,36 @@ abstract class FileHookTestBase extends FileTestBase {
     }
     $this->assertEqual($actual_count, $expected_count, $message);
   }
+
+  /**
+   * Create a file and save it to the files table and assert that it occurs
+   * correctly.
+   *
+   * @param $filepath
+   *   Optional string specifying the file path. If none is provided then a
+   *   randomly named file will be created in the site's files directory.
+   * @param $contents
+   *   Optional contents to save into the file. If a NULL value is provided an
+   *   arbitrary string will be used.
+   * @param $scheme
+   *   Optional string indicating the stream scheme to use. Drupal core includes
+   *   public, private, and temporary. The public wrapper is the default.
+   * @return
+   *   File object.
+   */
+  function createFile($filepath = NULL, $contents = NULL, $scheme = NULL) {
+    $file = new stdClass();
+    $file->uri = $this->createUri($filepath, $contents, $scheme);
+    $file->filename = drupal_basename($file->uri);
+    $file->filemime = 'text/plain';
+    $file->uid = 1;
+    $file->timestamp = REQUEST_TIME;
+    $file->filesize = filesize($file->uri);
+    $file->status = 0;
+    // Write the record directly rather than using the API so we don't invoke
+    // the hooks.
+    $this->assertNotIdentical(drupal_write_record('file_managed', $file), FALSE, t('The file was added to the database.'), 'Create test file');
+
+    return entity_create('file', (array) $file);
+  }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/LoadTest.php b/core/modules/file/lib/Drupal/file/Tests/LoadTest.php
similarity index 96%
rename from core/modules/system/lib/Drupal/system/Tests/File/LoadTest.php
rename to core/modules/file/lib/Drupal/file/Tests/LoadTest.php
index 62033a9..833c260 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/LoadTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/LoadTest.php
@@ -2,15 +2,15 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\LoadTest.
+ * Definition of Drupal\file\Tests\LoadTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  * Tests the file_load() function.
  */
-class LoadTest extends FileHookTestBase {
+class LoadTest extends FileManagedTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File loading',
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/MoveTest.php b/core/modules/file/lib/Drupal/file/Tests/MoveTest.php
similarity index 98%
rename from core/modules/system/lib/Drupal/system/Tests/File/MoveTest.php
rename to core/modules/file/lib/Drupal/file/Tests/MoveTest.php
index 64f12eb..15868b1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/MoveTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/MoveTest.php
@@ -2,15 +2,15 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\MoveTest.
+ * Definition of Drupal\file\Tests\MoveTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  * Move related tests
  */
-class MoveTest extends FileHookTestBase {
+class MoveTest extends FileManagedTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File moving',
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileSaveUploadTest.php b/core/modules/file/lib/Drupal/file/Tests/RemoteFileSaveUploadTest.php
similarity index 82%
rename from core/modules/system/lib/Drupal/system/Tests/File/RemoteFileSaveUploadTest.php
rename to core/modules/file/lib/Drupal/file/Tests/RemoteFileSaveUploadTest.php
index 3e71f0a..ed587d2 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileSaveUploadTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/RemoteFileSaveUploadTest.php
@@ -2,10 +2,10 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\RemoteFileSaveUploadTest.
+ * Definition of Drupal\file\Tests\RemoteFileSaveUploadTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  * Tests the file_save_upload() function on remote filesystems.
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/SaveDataTest.php b/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php
similarity index 97%
rename from core/modules/system/lib/Drupal/system/Tests/File/SaveDataTest.php
rename to core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php
index a8de40d..ecdb201 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/SaveDataTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php
@@ -2,15 +2,15 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\SaveDataTest.
+ * Definition of Drupal\file\Tests\SaveDataTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  * Tests the file_save_data() function.
  */
-class SaveDataTest extends FileHookTestBase {
+class SaveDataTest extends FileManagedTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File save data',
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/SaveTest.php b/core/modules/file/lib/Drupal/file/Tests/SaveTest.php
similarity index 95%
rename from core/modules/system/lib/Drupal/system/Tests/File/SaveTest.php
rename to core/modules/file/lib/Drupal/file/Tests/SaveTest.php
index 7b70192..e2611e5 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/SaveTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/SaveTest.php
@@ -2,15 +2,15 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\SaveTest.
+ * Definition of Drupal\file\Tests\SaveTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  * Tests saving files.
  */
-class SaveTest extends FileHookTestBase {
+class SaveTest extends FileManagedTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File saving',
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/SaveUploadTest.php b/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php
similarity index 98%
rename from core/modules/system/lib/Drupal/system/Tests/File/SaveUploadTest.php
rename to core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php
index f5391b7..c2adbd6 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/SaveUploadTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php
@@ -2,15 +2,15 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\SaveUploadTest.
+ * Definition of Drupal\file\Tests\SaveUploadTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  * Test the file_save_upload() function.
  */
-class SaveUploadTest extends FileHookTestBase {
+class SaveUploadTest extends FileManagedTestBase {
   /**
    * An image file path for uploading.
    */
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/SpaceUsedTest.php b/core/modules/file/lib/Drupal/file/Tests/SpaceUsedTest.php
similarity index 94%
rename from core/modules/system/lib/Drupal/system/Tests/File/SpaceUsedTest.php
rename to core/modules/file/lib/Drupal/file/Tests/SpaceUsedTest.php
index b5866a1..db62d5a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/SpaceUsedTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/SpaceUsedTest.php
@@ -2,15 +2,15 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\SpaceUsedTest.
+ * Definition of Drupal\file\Tests\SpaceUsedTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  *  This will run tests against the file_space_used() function.
  */
-class SpaceUsedTest extends FileTestBase {
+class SpaceUsedTest extends FileManagedTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File space used tests',
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UsageTest.php b/core/modules/file/lib/Drupal/file/Tests/UsageTest.php
similarity index 62%
rename from core/modules/system/lib/Drupal/system/Tests/File/UsageTest.php
rename to core/modules/file/lib/Drupal/file/Tests/UsageTest.php
index 31f64da..b3239fd 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/UsageTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/UsageTest.php
@@ -2,20 +2,20 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\UsageTest.
+ * Definition of Drupal\file\Tests\UsageTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  * Tests file usage functions.
  */
-class UsageTest extends FileTestBase {
+class UsageTest extends FileManagedTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File usage',
       'description' => 'Tests the file usage functions.',
-      'group' => 'File',
+      'group' => 'File API',
     );
   }
 
@@ -119,4 +119,50 @@ class UsageTest extends FileTestBase {
       ->fetchField();
     $this->assertIdentical(FALSE, $count, t('Decrementing non-exist record complete.'));
   }
+
+  /**
+   * Ensure that temporary files are removed.
+   *
+   * Create files for all the possible combinations of age and status. We are
+   * using UPDATE statements because using the API would set the timestamp.
+   */
+  function testTempFileCleanup() {
+    // Temporary file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
+    $temp_old = file_save_data('');
+    db_update('file_managed')
+      ->fields(array(
+        'status' => 0,
+        'timestamp' => 1,
+      ))
+      ->condition('fid', $temp_old->fid)
+      ->execute();
+    $this->assertTrue(file_exists($temp_old->uri), t('Old temp file was created correctly.'));
+
+    // Temporary file that is less than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
+    $temp_new = file_save_data('');
+    db_update('file_managed')
+      ->fields(array('status' => 0))
+      ->condition('fid', $temp_new->fid)
+      ->execute();
+    $this->assertTrue(file_exists($temp_new->uri), t('New temp file was created correctly.'));
+
+    // Permanent file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
+    $perm_old = file_save_data('');
+    db_update('file_managed')
+      ->fields(array('timestamp' => 1))
+      ->condition('fid', $temp_old->fid)
+      ->execute();
+    $this->assertTrue(file_exists($perm_old->uri), t('Old permanent file was created correctly.'));
+
+    // Permanent file that is newer than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
+    $perm_new = file_save_data('');
+    $this->assertTrue(file_exists($perm_new->uri), t('New permanent file was created correctly.'));
+
+    // Run cron and then ensure that only the old, temp file was deleted.
+    $this->cronRun();
+    $this->assertFalse(file_exists($temp_old->uri), t('Old temp file was correctly removed.'));
+    $this->assertTrue(file_exists($temp_new->uri), t('New temp file was correctly ignored.'));
+    $this->assertTrue(file_exists($perm_old->uri), t('Old permanent file was correctly ignored.'));
+    $this->assertTrue(file_exists($perm_new->uri), t('New permanent file was correctly ignored.'));
+  }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/ValidateTest.php b/core/modules/file/lib/Drupal/file/Tests/ValidateTest.php
similarity index 91%
rename from core/modules/system/lib/Drupal/system/Tests/File/ValidateTest.php
rename to core/modules/file/lib/Drupal/file/Tests/ValidateTest.php
index 98d46e3..2418382 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/ValidateTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/ValidateTest.php
@@ -2,15 +2,15 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\ValidateTest.
+ * Definition of Drupal\file\Tests\ValidateTest.
  */
 
-namespace Drupal\system\Tests\File;
+namespace Drupal\file\Tests;
 
 /**
  * Tests the file_validate() function.
  */
-class ValidateTest extends FileHookTestBase {
+class ValidateTest extends FileManagedTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File validate',
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/ValidatorTest.php b/core/modules/file/lib/Drupal/file/Tests/ValidatorTest.php
similarity index 97%
rename from core/modules/system/lib/Drupal/system/Tests/File/ValidatorTest.php
rename to core/modules/file/lib/Drupal/file/Tests/ValidatorTest.php
index 3f8e548..67b72b7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/ValidatorTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/ValidatorTest.php
@@ -2,17 +2,15 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\File\ValidatorTest.
+ * Definition of Drupal\file\Tests\ValidatorTest.
  */
 
-namespace Drupal\system\Tests\File;
-
-use Drupal\simpletest\WebTestBase;
+namespace Drupal\file\Tests;
 
 /**
  *  This will run tests against the file validation functions (file_validate_*).
  */
-class ValidatorTest extends WebTestBase {
+class ValidatorTest extends FileManagedTestBase {
   public static function getInfo() {
     return array(
       'name' => 'File validator tests',
diff --git a/core/modules/file/tests/file_module_test.module b/core/modules/file/tests/file_module_test.module
index 662d2b8..c9dd819 100644
--- a/core/modules/file/tests/file_module_test.module
+++ b/core/modules/file/tests/file_module_test.module
@@ -6,6 +6,7 @@
  */
 
 use Drupal\entity\EntityInterface;
+use Drupal\file\File;
 
 /**
  * Implements hook_menu().
@@ -74,7 +75,7 @@ function file_module_test_form_submit($form, &$form_state) {
 /**
  * Implements hook_file_download_access().
  */
-function file_module_test_file_download_access($field, EntityInterface $entity, $field_item) {
+function file_module_test_file_download_access($field, EntityInterface $entity, File $file) {
   $instance = field_info_instance($entity->entityType(), $field['field_name'], $entity->bundle());
   // Allow the file to be downloaded only if the given arguments are correct.
   // If any are wrong, $instance will be NULL.
diff --git a/core/modules/system/tests/modules/file_test/file_test.info b/core/modules/file/tests/file_test/file_test.info
similarity index 100%
rename from core/modules/system/tests/modules/file_test/file_test.info
rename to core/modules/file/tests/file_test/file_test.info
diff --git a/core/modules/system/tests/modules/file_test/file_test.module b/core/modules/file/tests/file_test/file_test.module
similarity index 99%
rename from core/modules/system/tests/modules/file_test/file_test.module
rename to core/modules/file/tests/file_test/file_test.module
index 20e45cb..46b8604 100644
--- a/core/modules/system/tests/modules/file_test/file_test.module
+++ b/core/modules/file/tests/file_test/file_test.module
@@ -8,7 +8,7 @@
  * calling file_test_get_calls() or file_test_set_return().
  */
 
-use Drupal\Core\File\File;
+use Drupal\file\File;
 
 const FILE_URL_TEST_CDN_1 = 'http://cdn1.example.com';
 const FILE_URL_TEST_CDN_2 = 'http://cdn2.example.com';
diff --git a/core/modules/system/tests/modules/file_test/lib/Drupal/file_test/DummyRemoteStreamWrapper.php b/core/modules/file/tests/file_test/lib/Drupal/file_test/DummyRemoteStreamWrapper.php
similarity index 100%
rename from core/modules/system/tests/modules/file_test/lib/Drupal/file_test/DummyRemoteStreamWrapper.php
rename to core/modules/file/tests/file_test/lib/Drupal/file_test/DummyRemoteStreamWrapper.php
diff --git a/core/modules/system/tests/modules/file_test/lib/Drupal/file_test/DummyStreamWrapper.php b/core/modules/file/tests/file_test/lib/Drupal/file_test/DummyStreamWrapper.php
similarity index 100%
rename from core/modules/system/tests/modules/file_test/lib/Drupal/file_test/DummyStreamWrapper.php
rename to core/modules/file/tests/file_test/lib/Drupal/file_test/DummyStreamWrapper.php
diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index 25b7ea6..6207d3a 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -8,7 +8,7 @@
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\HttpFoundation\StreamedResponse;
 use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
-use Drupal\Core\File\File;
+use Drupal\file\File;
 
 /**
  * Image style constant for user presets in the database.
diff --git a/core/modules/locale/locale.info b/core/modules/locale/locale.info
index e0749db..1e7a4ae 100644
--- a/core/modules/locale/locale.info
+++ b/core/modules/locale/locale.info
@@ -4,3 +4,4 @@ package = Core
 version = VERSION
 core = 8.x
 dependencies[] = language
+dependencies[] = file
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php b/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php
index 8a33ea6..6dd7b49 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php
@@ -8,7 +8,6 @@
 namespace Drupal\system\Tests\File;
 
 use Drupal\simpletest\WebTestBase;
-use stdClass;
 
 /**
  * Base class for file tests that adds some additional file specific
@@ -159,9 +158,8 @@ abstract class FileTestBase extends WebTestBase {
     return $path;
   }
 
-  /**
-   * Create a file and save it to the files table and assert that it occurs
-   * correctly.
+    /**
+   * Create a file and return the URI of it.
    *
    * @param $filepath
    *   Optional string specifying the file path. If none is provided then a
@@ -173,9 +171,9 @@ abstract class FileTestBase extends WebTestBase {
    *   Optional string indicating the stream scheme to use. Drupal core includes
    *   public, private, and temporary. The public wrapper is the default.
    * @return
-   *   File object.
+   *   File URI.
    */
-  function createFile($filepath = NULL, $contents = NULL, $scheme = NULL) {
+  function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
     if (!isset($filepath)) {
       // Prefix with non-latin characters to ensure that all file-related
       // tests work with international filenames.
@@ -192,19 +190,6 @@ abstract class FileTestBase extends WebTestBase {
 
     file_put_contents($filepath, $contents);
     $this->assertTrue(is_file($filepath), t('The test file exists on the disk.'), 'Create test file');
-
-    $file = new stdClass();
-    $file->uri = $filepath;
-    $file->filename = drupal_basename($file->uri);
-    $file->filemime = 'text/plain';
-    $file->uid = 1;
-    $file->timestamp = REQUEST_TIME;
-    $file->filesize = filesize($file->uri);
-    $file->status = 0;
-    // Write the record directly rather than using the API so we don't invoke
-    // the hooks.
-    $this->assertNotIdentical(drupal_write_record('file_managed', $file), FALSE, t('The file was added to the database.'), 'Create test file');
-
-    return entity_create('file', (array) $file);
+    return $filepath;
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php
index 5d5aa21..c4a44f9 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php
@@ -24,24 +24,24 @@ class UnmanagedCopyTest extends FileTestBase {
    */
   function testNormal() {
     // Create a file for testing
-    $file = $this->createFile();
+    $uri = $this->createUri();
 
     // Copying to a new name.
     $desired_filepath = 'public://' . $this->randomName();
-    $new_filepath = file_unmanaged_copy($file->uri, $desired_filepath, FILE_EXISTS_ERROR);
+    $new_filepath = file_unmanaged_copy($uri, $desired_filepath, FILE_EXISTS_ERROR);
     $this->assertTrue($new_filepath, t('Copy was successful.'));
     $this->assertEqual($new_filepath, $desired_filepath, t('Returned expected filepath.'));
-    $this->assertTrue(file_exists($file->uri), t('Original file remains.'));
+    $this->assertTrue(file_exists($uri), t('Original file remains.'));
     $this->assertTrue(file_exists($new_filepath), t('New file exists.'));
     $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664));
 
     // Copying with rename.
     $desired_filepath = 'public://' . $this->randomName();
     $this->assertTrue(file_put_contents($desired_filepath, ' '), t('Created a file so a rename will have to happen.'));
-    $newer_filepath = file_unmanaged_copy($file->uri, $desired_filepath, FILE_EXISTS_RENAME);
+    $newer_filepath = file_unmanaged_copy($uri, $desired_filepath, FILE_EXISTS_RENAME);
     $this->assertTrue($newer_filepath, t('Copy was successful.'));
     $this->assertNotEqual($newer_filepath, $desired_filepath, t('Returned expected filepath.'));
-    $this->assertTrue(file_exists($file->uri), t('Original file remains.'));
+    $this->assertTrue(file_exists($uri), t('Original file remains.'));
     $this->assertTrue(file_exists($newer_filepath), t('New file exists.'));
     $this->assertFilePermissions($newer_filepath, variable_get('file_chmod_file', 0664));
 
@@ -65,31 +65,31 @@ class UnmanagedCopyTest extends FileTestBase {
    */
   function testOverwriteSelf() {
     // Create a file for testing
-    $file = $this->createFile();
+    $uri = $this->createUri();
 
     // Copy the file onto itself with renaming works.
-    $new_filepath = file_unmanaged_copy($file->uri, $file->uri, FILE_EXISTS_RENAME);
+    $new_filepath = file_unmanaged_copy($uri, $uri, FILE_EXISTS_RENAME);
     $this->assertTrue($new_filepath, t('Copying onto itself with renaming works.'));
-    $this->assertNotEqual($new_filepath, $file->uri, t('Copied file has a new name.'));
-    $this->assertTrue(file_exists($file->uri), t('Original file exists after copying onto itself.'));
+    $this->assertNotEqual($new_filepath, $uri, t('Copied file has a new name.'));
+    $this->assertTrue(file_exists($uri), t('Original file exists after copying onto itself.'));
     $this->assertTrue(file_exists($new_filepath), t('Copied file exists after copying onto itself.'));
     $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664));
 
     // Copy the file onto itself without renaming fails.
-    $new_filepath = file_unmanaged_copy($file->uri, $file->uri, FILE_EXISTS_ERROR);
+    $new_filepath = file_unmanaged_copy($uri, $uri, FILE_EXISTS_ERROR);
     $this->assertFalse($new_filepath, t('Copying onto itself without renaming fails.'));
-    $this->assertTrue(file_exists($file->uri), t('File exists after copying onto itself.'));
+    $this->assertTrue(file_exists($uri), t('File exists after copying onto itself.'));
 
     // Copy the file into same directory without renaming fails.
-    $new_filepath = file_unmanaged_copy($file->uri, drupal_dirname($file->uri), FILE_EXISTS_ERROR);
+    $new_filepath = file_unmanaged_copy($uri, drupal_dirname($uri), FILE_EXISTS_ERROR);
     $this->assertFalse($new_filepath, t('Copying onto itself fails.'));
-    $this->assertTrue(file_exists($file->uri), t('File exists after copying onto itself.'));
+    $this->assertTrue(file_exists($uri), t('File exists after copying onto itself.'));
 
     // Copy the file into same directory with renaming works.
-    $new_filepath = file_unmanaged_copy($file->uri, drupal_dirname($file->uri), FILE_EXISTS_RENAME);
+    $new_filepath = file_unmanaged_copy($uri, drupal_dirname($uri), FILE_EXISTS_RENAME);
     $this->assertTrue($new_filepath, t('Copying into same directory works.'));
-    $this->assertNotEqual($new_filepath, $file->uri, t('Copied file has a new name.'));
-    $this->assertTrue(file_exists($file->uri), t('Original file exists after copying onto itself.'));
+    $this->assertNotEqual($new_filepath, $uri, t('Copied file has a new name.'));
+    $this->assertTrue(file_exists($uri), t('Original file exists after copying onto itself.'));
     $this->assertTrue(file_exists($new_filepath), t('Copied file exists after copying onto itself.'));
     $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664));
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php
index 326bb5b..8ecd1ae 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php
@@ -24,11 +24,11 @@ class UnmanagedDeleteTest extends FileTestBase {
    */
   function testNormal() {
     // Create a file for testing
-    $file = $this->createFile();
+    $uri = $this->createUri();
 
     // Delete a regular file
-    $this->assertTrue(file_unmanaged_delete($file->uri), t('Deleted worked.'));
-    $this->assertFalse(file_exists($file->uri), t('Test file has actually been deleted.'));
+    $this->assertTrue(file_unmanaged_delete($uri), t('Deleted worked.'));
+    $this->assertFalse(file_exists($uri), t('Test file has actually been deleted.'));
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php
index 4e5c8c4..1090aaa 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php
@@ -24,15 +24,15 @@ class UnmanagedMoveTest extends FileTestBase {
    */
   function testNormal() {
     // Create a file for testing
-    $file = $this->createFile();
+    $uri = $this->createUri();
 
     // Moving to a new name.
     $desired_filepath = 'public://' . $this->randomName();
-    $new_filepath = file_unmanaged_move($file->uri, $desired_filepath, FILE_EXISTS_ERROR);
+    $new_filepath = file_unmanaged_move($uri, $desired_filepath, FILE_EXISTS_ERROR);
     $this->assertTrue($new_filepath, t('Move was successful.'));
     $this->assertEqual($new_filepath, $desired_filepath, t('Returned expected filepath.'));
     $this->assertTrue(file_exists($new_filepath), t('File exists at the new location.'));
-    $this->assertFalse(file_exists($file->uri), t('No file remains at the old location.'));
+    $this->assertFalse(file_exists($uri), t('No file remains at the old location.'));
     $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664));
 
     // Moving with rename.
@@ -64,17 +64,17 @@ class UnmanagedMoveTest extends FileTestBase {
    */
   function testOverwriteSelf() {
     // Create a file for testing.
-    $file = $this->createFile();
+    $uri = $this->createUri();
 
     // Move the file onto itself without renaming shouldn't make changes.
-    $new_filepath = file_unmanaged_move($file->uri, $file->uri, FILE_EXISTS_REPLACE);
+    $new_filepath = file_unmanaged_move($uri, $uri, FILE_EXISTS_REPLACE);
     $this->assertFalse($new_filepath, t('Moving onto itself without renaming fails.'));
-    $this->assertTrue(file_exists($file->uri), t('File exists after moving onto itself.'));
+    $this->assertTrue(file_exists($uri), t('File exists after moving onto itself.'));
 
     // Move the file onto itself with renaming will result in a new filename.
-    $new_filepath = file_unmanaged_move($file->uri, $file->uri, FILE_EXISTS_RENAME);
+    $new_filepath = file_unmanaged_move($uri, $uri, FILE_EXISTS_RENAME);
     $this->assertTrue($new_filepath, t('Moving onto itself with renaming works.'));
-    $this->assertFalse(file_exists($file->uri), t('Original file has been removed.'));
+    $this->assertFalse(file_exists($uri), t('Original file has been removed.'));
     $this->assertTrue(file_exists($new_filepath), t('File exists after moving onto itself.'));
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UrlRewritingTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UrlRewritingTest.php
index 4273f7f..5422f90 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/UrlRewritingTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/UrlRewritingTest.php
@@ -70,21 +70,21 @@ class UrlRewritingTest extends FileTestBase {
 
     // Test alteration of file URLs to use a CDN.
     variable_set('file_test_hook_file_url_alter', 'cdn');
-    $file = $this->createFile();
-    $url = file_create_url($file->uri);
+    $uri = $this->createUri();
+    $url = file_create_url($uri);
     $public_directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath();
-    $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . $public_directory_path . '/' . $file->filename, $url, t('Correctly generated a CDN URL for a created file.'));
+    $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . $public_directory_path . '/' . drupal_basename($uri), $url, t('Correctly generated a CDN URL for a created file.'));
 
     // Test alteration of file URLs to use root-relative URLs.
     variable_set('file_test_hook_file_url_alter', 'root-relative');
-    $file = $this->createFile();
-    $url = file_create_url($file->uri);
-    $this->assertEqual(base_path() . '/' . $public_directory_path . '/' . $file->filename, $url, t('Correctly generated a root-relative URL for a created file.'));
+    $uri = $this->createUri();
+    $url = file_create_url($uri);
+    $this->assertEqual(base_path() . '/' . $public_directory_path . '/' . drupal_basename($uri), $url, t('Correctly generated a root-relative URL for a created file.'));
 
     // Test alteration of file URLs to use a protocol-relative URLs.
     variable_set('file_test_hook_file_url_alter', 'protocol-relative');
-    $file = $this->createFile();
-    $url = file_create_url($file->uri);
-    $this->assertEqual('/' . base_path() . '/' . $public_directory_path . '/' . $file->filename, $url, t('Correctly generated a protocol-relative URL for a created file.'));
+    $uri = $this->createUri();
+    $url = file_create_url($uri);
+    $this->assertEqual('/' . base_path() . '/' . $public_directory_path . '/' . drupal_basename($uri), $url, t('Correctly generated a protocol-relative URL for a created file.'));
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php b/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php
index e13d578..ebdb103 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php
@@ -87,52 +87,6 @@ class CronRunTest extends WebTestBase {
   }
 
   /**
-   * Ensure that temporary files are removed.
-   *
-   * Create files for all the possible combinations of age and status. We are
-   * using UPDATE statements because using the API would set the timestamp.
-   */
-  function testTempFileCleanup() {
-    // Temporary file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
-    $temp_old = file_save_data('');
-    db_update('file_managed')
-      ->fields(array(
-        'status' => 0,
-        'timestamp' => 1,
-      ))
-      ->condition('fid', $temp_old->fid)
-      ->execute();
-    $this->assertTrue(file_exists($temp_old->uri), t('Old temp file was created correctly.'));
-
-    // Temporary file that is less than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
-    $temp_new = file_save_data('');
-    db_update('file_managed')
-      ->fields(array('status' => 0))
-      ->condition('fid', $temp_new->fid)
-      ->execute();
-    $this->assertTrue(file_exists($temp_new->uri), t('New temp file was created correctly.'));
-
-    // Permanent file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
-    $perm_old = file_save_data('');
-    db_update('file_managed')
-      ->fields(array('timestamp' => 1))
-      ->condition('fid', $temp_old->fid)
-      ->execute();
-    $this->assertTrue(file_exists($perm_old->uri), t('Old permanent file was created correctly.'));
-
-    // Permanent file that is newer than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
-    $perm_new = file_save_data('');
-    $this->assertTrue(file_exists($perm_new->uri), t('New permanent file was created correctly.'));
-
-    // Run cron and then ensure that only the old, temp file was deleted.
-    $this->cronRun();
-    $this->assertFalse(file_exists($temp_old->uri), t('Old temp file was correctly removed.'));
-    $this->assertTrue(file_exists($temp_new->uri), t('New temp file was correctly ignored.'));
-    $this->assertTrue(file_exists($perm_old->uri), t('Old permanent file was correctly ignored.'));
-    $this->assertTrue(file_exists($perm_new->uri), t('New permanent file was correctly ignored.'));
-  }
-
-  /**
    * Make sure exceptions thrown on hook_cron() don't affect other modules.
    */
   function testCronExceptions() {
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php
index b4139e2..3d0188d 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php
@@ -19,7 +19,7 @@ class ThemeTest extends WebTestBase {
    *
    * @var array
    */
-  public static $modules = array('node', 'block');
+  public static $modules = array('node', 'block', 'file');
 
   public static function getInfo() {
     return array(
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index 8aa3ed4..8dd0fd2 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -439,8 +439,8 @@ function system_theme_settings($form, &$form_state, $key = '') {
     $form['theme_settings']['#access'] = FALSE;
   }
 
-  // Logo settings
-  if ((!$key) || in_array('logo', $features)) {
+  // Logo settings, only available when file.module is enabled.
+  if ((!$key) || in_array('logo', $features) && module_exists('file')) {
     $form['logo'] = array(
       '#type' => 'fieldset',
       '#title' => t('Logo image settings'),
@@ -474,7 +474,7 @@ function system_theme_settings($form, &$form_state, $key = '') {
     );
   }
 
-  if ((!$key) || in_array('favicon', $features)) {
+  if ((!$key) || in_array('favicon', $features) && module_exists('file')) {
     $form['favicon'] = array(
       '#type' => 'fieldset',
       '#title' => t('Shortcut icon settings'),
@@ -603,51 +603,53 @@ function system_theme_settings($form, &$form_state, $key = '') {
  * Validator for the system_theme_settings() form.
  */
 function system_theme_settings_validate($form, &$form_state) {
-  // Handle file uploads.
-  $validators = array('file_validate_is_image' => array());
-
-  // Check for a new uploaded logo.
-  $file = file_save_upload('logo_upload', $validators);
-  if (isset($file)) {
-    // File upload was attempted.
-    if ($file) {
-      // Put the temporary file in form_values so we can save it on submit.
-      $form_state['values']['logo_upload'] = $file;
-    }
-    else {
-      // File upload failed.
-      form_set_error('logo_upload', t('The logo could not be uploaded.'));
+  if (module_exists('file')) {
+    // Handle file uploads.
+    $validators = array('file_validate_is_image' => array());
+
+    // Check for a new uploaded logo.
+    $file = file_save_upload('logo_upload', $validators);
+    if (isset($file)) {
+      // File upload was attempted.
+      if ($file) {
+        // Put the temporary file in form_values so we can save it on submit.
+        $form_state['values']['logo_upload'] = $file;
+      }
+      else {
+        // File upload failed.
+        form_set_error('logo_upload', t('The logo could not be uploaded.'));
+      }
     }
-  }
 
-  $validators = array('file_validate_extensions' => array('ico png gif jpg jpeg apng svg'));
+    $validators = array('file_validate_extensions' => array('ico png gif jpg jpeg apng svg'));
 
-  // Check for a new uploaded favicon.
-  $file = file_save_upload('favicon_upload', $validators);
-  if (isset($file)) {
-    // File upload was attempted.
-    if ($file) {
-      // Put the temporary file in form_values so we can save it on submit.
-      $form_state['values']['favicon_upload'] = $file;
-    }
-    else {
-      // File upload failed.
-      form_set_error('favicon_upload', t('The favicon could not be uploaded.'));
+    // Check for a new uploaded favicon.
+    $file = file_save_upload('favicon_upload', $validators);
+    if (isset($file)) {
+      // File upload was attempted.
+      if ($file) {
+        // Put the temporary file in form_values so we can save it on submit.
+        $form_state['values']['favicon_upload'] = $file;
+      }
+      else {
+        // File upload failed.
+        form_set_error('favicon_upload', t('The favicon could not be uploaded.'));
+      }
     }
-  }
 
-  // If the user provided a path for a logo or favicon file, make sure a file
-  // exists at that path.
-  if ($form_state['values']['logo_path']) {
-    $path = _system_theme_settings_validate_path($form_state['values']['logo_path']);
-    if (!$path) {
-      form_set_error('logo_path', t('The custom logo path is invalid.'));
+    // If the user provided a path for a logo or favicon file, make sure a file
+    // exists at that path.
+    if ($form_state['values']['logo_path']) {
+      $path = _system_theme_settings_validate_path($form_state['values']['logo_path']);
+      if (!$path) {
+        form_set_error('logo_path', t('The custom logo path is invalid.'));
+      }
     }
-  }
-  if ($form_state['values']['favicon_path']) {
-    $path = _system_theme_settings_validate_path($form_state['values']['favicon_path']);
-    if (!$path) {
-      form_set_error('favicon_path', t('The custom favicon path is invalid.'));
+    if ($form_state['values']['favicon_path']) {
+      $path = _system_theme_settings_validate_path($form_state['values']['favicon_path']);
+      if (!$path) {
+        form_set_error('favicon_path', t('The custom favicon path is invalid.'));
+      }
     }
   }
 }
@@ -700,32 +702,34 @@ function system_theme_settings_submit($form, &$form_state) {
 
   // If the user uploaded a new logo or favicon, save it to a permanent location
   // and use it in place of the default theme-provided file.
-  if ($file = $values['logo_upload']) {
-    unset($values['logo_upload']);
-    $filename = file_unmanaged_copy($file->uri);
-    $values['default_logo'] = 0;
-    $values['logo_path'] = $filename;
-    $values['toggle_logo'] = 1;
-  }
-  if ($file = $values['favicon_upload']) {
-    unset($values['favicon_upload']);
-    $filename = file_unmanaged_copy($file->uri);
-    $values['default_favicon'] = 0;
-    $values['favicon_path'] = $filename;
-    $values['toggle_favicon'] = 1;
-  }
+  if (module_exists('file')) {
+    if ($file = $values['logo_upload']) {
+      unset($values['logo_upload']);
+      $filename = file_unmanaged_copy($file->uri);
+      $values['default_logo'] = 0;
+      $values['logo_path'] = $filename;
+      $values['toggle_logo'] = 1;
+    }
+    if ($file = $values['favicon_upload']) {
+      unset($values['favicon_upload']);
+      $filename = file_unmanaged_copy($file->uri);
+      $values['default_favicon'] = 0;
+      $values['favicon_path'] = $filename;
+      $values['toggle_favicon'] = 1;
+    }
 
-  // If the user entered a path relative to the system files directory for
-  // a logo or favicon, store a public:// URI so the theme system can handle it.
-  if (!empty($values['logo_path'])) {
-    $values['logo_path'] = _system_theme_settings_validate_path($values['logo_path']);
-  }
-  if (!empty($values['favicon_path'])) {
-    $values['favicon_path'] = _system_theme_settings_validate_path($values['favicon_path']);
-  }
+    // If the user entered a path relative to the system files directory for
+    // a logo or favicon, store a public:// URI so the theme system can handle it.
+    if (!empty($values['logo_path'])) {
+      $values['logo_path'] = _system_theme_settings_validate_path($values['logo_path']);
+    }
+    if (!empty($values['favicon_path'])) {
+      $values['favicon_path'] = _system_theme_settings_validate_path($values['favicon_path']);
+    }
 
-  if (empty($values['default_favicon']) && !empty($values['favicon_path'])) {
-    $values['favicon_mimetype'] = file_get_mimetype($values['favicon_path']);
+    if (empty($values['default_favicon']) && !empty($values['favicon_path'])) {
+      $values['favicon_mimetype'] = file_get_mimetype($values['favicon_path']);
+    }
   }
 
   variable_set($key, $values);
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index 1333429..89e3714 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -6,7 +6,6 @@
  */
 
 use Drupal\Core\Utility\UpdateException;
-use Drupal\Core\File\File;
 
 /**
  * @addtogroup hooks
@@ -2266,163 +2265,6 @@ function hook_stream_wrappers_alter(&$wrappers) {
 }
 
 /**
- * Load additional information into file entities.
- *
- * file_load_multiple() calls this hook to allow modules to load
- * additional information into each file.
- *
- * @param $files
- *   An array of file entities, indexed by fid.
- *
- * @see file_load_multiple()
- * @see file_load()
- */
-function hook_file_load($files) {
-  // Add the upload specific data into the file entity.
-  $result = db_query('SELECT * FROM {upload} u WHERE u.fid IN (:fids)', array(':fids' => array_keys($files)))->fetchAll(PDO::FETCH_ASSOC);
-  foreach ($result as $record) {
-    foreach ($record as $key => $value) {
-      $files[$record['fid']]->$key = $value;
-    }
-  }
-}
-
-/**
- * Check that files meet a given criteria.
- *
- * This hook lets modules perform additional validation on files. They're able
- * to report a failure by returning one or more error messages.
- *
- * @param Drupal\Core\File\File $file
- *   The file entity being validated.
- * @return
- *   An array of error messages. If there are no problems with the file return
- *   an empty array.
- *
- * @see file_validate()
- */
-function hook_file_validate(Drupal\Core\File\File $file) {
-  $errors = array();
-
-  if (empty($file->filename)) {
-    $errors[] = t("The file's name is empty. Please give a name to the file.");
-  }
-  if (strlen($file->filename) > 255) {
-    $errors[] = t("The file's name exceeds the 255 characters limit. Please rename the file and try again.");
-  }
-
-  return $errors;
-}
-
-/**
- * Act on a file being inserted or updated.
- *
- * This hook is called when a file has been added to the database. The hook
- * doesn't distinguish between files created as a result of a copy or those
- * created by an upload.
- *
- * @param Drupal\Core\File\File $file
- *   The file entity that is about to be created or updated.
- */
-function hook_file_presave(Drupal\Core\File\File $file) {
-  // Change the file timestamp to an hour prior.
-  $file->timestamp -= 3600;
-}
-
-/**
- * Respond to a file being added.
- *
- * This hook is called after a file has been added to the database. The hook
- * doesn't distinguish between files created as a result of a copy or those
- * created by an upload.
- *
- * @param Drupal\Core\File\File $file
- *   The file that has been added.
- */
-function hook_file_insert(Drupal\Core\File\File $file) {
-  // Add a message to the log, if the file is a jpg
-  $validate = file_validate_extensions($file, 'jpg');
-  if (empty($validate)) {
-    watchdog('file', 'A jpg has been added.');
-  }
-}
-
-/**
- * Respond to a file being updated.
- *
- * This hook is called when an existing file is saved.
- *
- * @param Drupal\Core\File\File $file
- *   The file that has just been updated.
- */
-function hook_file_update(Drupal\Core\File\File $file) {
-
-}
-
-/**
- * Respond to a file that has been copied.
- *
- * @param Drupal\Core\File\File $file
- *   The newly copied file entity.
- * @param Drupal\Core\File\File $source
- *   The original file before the copy.
- *
- * @see file_copy()
- */
-function hook_file_copy(Drupal\Core\File\File $file, Drupal\Core\File\File $source) {
-
-}
-
-/**
- * Respond to a file that has been moved.
- *
- * @param Drupal\Core\File\File $file
- *   The updated file entity after the move.
- * @param Drupal\Core\File\File $source
- *   The original file entity before the move.
- *
- * @see file_move()
- */
-function hook_file_move(Drupal\Core\File\File $file, Drupal\Core\File\File $source) {
-
-}
-
-/**
- * Act prior to file deletion.
- *
- * This hook is invoked when deleting a file before the file is removed from the
- * filesystem and before its records are removed from the database.
- *
- * @param Drupal\Core\File\File $file
- *   The file that is about to be deleted.
- *
- * @see hook_file_delete()
- * @see Drupal\Core\File\FileStorageController::delete()
- * @see upload_file_delete()
- */
-function hook_file_predelete(Drupal\Core\File\File $file) {
-  // Delete all information associated with the file.
-  db_delete('upload')->condition('fid', $file->fid)->execute();
-}
-
-/**
- * Respond to file deletion.
- *
- * This hook is invoked after the file has been removed from
- * the filesystem and after its records have been removed from the database.
- *
- * @param Drupal\Core\File\File $file
- *   The file that has just been deleted.
- *
- * @see hook_file_predelete()
- * @see Drupal\Core\File\FileStorageController::delete()
- */
-function hook_file_delete(Drupal\Core\File\File $file) {
-  // Delete all information associated with the file.
-  db_delete('upload')->condition('fid', $file->fid)->execute();
-}
-
-/**
  * Control access to private file downloads and specify HTTP headers.
  *
  * This hook allows modules enforce permissions on file downloads when the
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index 0e42214..eea61d5 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -843,144 +843,6 @@ function system_schema() {
     'primary key' => array('type', 'language'),
   );
 
-  $schema['file_managed'] = array(
-    'description' => 'Stores information for uploaded files.',
-    'fields' => array(
-      'fid' => array(
-        'description' => 'File ID.',
-        'type' => 'serial',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'uuid' => array(
-        'description' => 'Unique Key: Universally unique identifier for this entity.',
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => FALSE,
-      ),
-      'uid' => array(
-        'description' => 'The {users}.uid of the user who is associated with the file.',
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'default' => 0,
-      ),
-      'filename' => array(
-        'description' => 'Name of the file with no path components. This may differ from the basename of the URI if the file is renamed to avoid overwriting an existing file.',
-        'type' => 'varchar',
-        'length' => 255,
-        'not null' => TRUE,
-        'default' => '',
-        'binary' => TRUE,
-      ),
-      'uri' => array(
-        'description' => 'The URI to access the file (either local or remote).',
-        'type' => 'varchar',
-        'length' => 255,
-        'not null' => TRUE,
-        'default' => '',
-        'binary' => TRUE,
-      ),
-      'langcode' => array(
-        'description' => 'The {language}.langcode of this file.',
-        'type' => 'varchar',
-        'length' => 12,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'filemime' => array(
-        'description' => "The file's MIME type.",
-        'type' => 'varchar',
-        'length' => 255,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'filesize' => array(
-        'description' => 'The size of the file in bytes.',
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'default' => 0,
-      ),
-      'status' => array(
-        'description' => 'A field indicating the status of the file. Two status are defined in core: temporary (0) and permanent (1). Temporary files older than DRUPAL_MAXIMUM_TEMP_FILE_AGE will be removed during a cron run.',
-        'type' => 'int',
-        'not null' => TRUE,
-        'default' => 0,
-        'size' => 'tiny',
-      ),
-      'timestamp' => array(
-        'description' => 'UNIX timestamp for when the file was added.',
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'default' => 0,
-      ),
-    ),
-    'indexes' => array(
-      'uid' => array('uid'),
-      'status' => array('status'),
-      'timestamp' => array('timestamp'),
-    ),
-    'unique keys' => array(
-      'uuid' => array('uuid'),
-      'uri' => array('uri'),
-    ),
-    'primary key' => array('fid'),
-    'foreign keys' => array(
-      'file_owner' => array(
-        'table' => 'users',
-        'columns' => array('uid' => 'uid'),
-      ),
-    ),
-  );
-
-  $schema['file_usage'] = array(
-    'description' => 'Track where a file is used.',
-    'fields' => array(
-      'fid' => array(
-        'description' => 'File ID.',
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'module' => array(
-        'description' => 'The name of the module that is using the file.',
-        'type' => 'varchar',
-        'length' => 255,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'type' => array(
-        'description' => 'The name of the object type in which the file is used.',
-        'type' => 'varchar',
-        'length' => 64,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'id' => array(
-        'description' => 'The primary key of the object using the file.',
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'default' => 0,
-      ),
-      'count' => array(
-        'description' => 'The number of times this file is used by this object.',
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'default' => 0,
-      ),
-    ),
-    'primary key' => array('fid', 'type', 'id', 'module'),
-    'indexes' => array(
-      'type_id' => array('type', 'id'),
-      'fid_count' => array('fid', 'count'),
-      'fid_module' => array('fid', 'module'),
-    ),
-  );
-
   $schema['flood'] = array(
     'description' => 'Flood controls the threshold of events, such as the number of contact attempts.',
     'fields' => array(
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index de7241f..3b28a42 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -270,26 +270,6 @@ function system_hook_info() {
 }
 
 /**
- * Implements hook_entity_info().
- */
-function system_entity_info() {
-  return array(
-    'file' => array(
-      'label' => t('File'),
-      'base table' => 'file_managed',
-      'controller class' => 'Drupal\Core\File\FileStorageController',
-      'entity class' => 'Drupal\Core\File\File',
-      'entity keys' => array(
-        'id' => 'fid',
-        'label' => 'filename',
-        'uuid' => 'uuid',
-      ),
-      'static cache' => FALSE,
-    ),
-  );
-}
-
-/**
  * Implements hook_element_info().
  */
 function system_element_info() {
@@ -3349,30 +3329,6 @@ function system_cron() {
     ->condition('expiration', REQUEST_TIME, '<')
     ->execute();
 
-  // Remove temporary files that are older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
-  // Use separate placeholders for the status to avoid a bug in some versions
-  // of PHP. See http://drupal.org/node/352956.
-  $result = db_query('SELECT fid FROM {file_managed} WHERE status <> :permanent AND timestamp < :timestamp', array(
-    ':permanent' => FILE_STATUS_PERMANENT,
-    ':timestamp' => REQUEST_TIME - DRUPAL_MAXIMUM_TEMP_FILE_AGE
-  ));
-  foreach ($result as $row) {
-    if ($file = file_load($row->fid)) {
-      $references = file_usage_list($file);
-      if (empty($references)) {
-        if (file_exists($file->uri)) {
-          $file->delete();
-        }
-        else {
-          watchdog('file system', 'Could not delete temporary file "%path" during garbage collection', array('%path' => $file->uri), WATCHDOG_ERROR);
-        }
-      }
-      else {
-        watchdog('file system', 'Did not delete temporary file "%path" during garbage collection because it is in use by the following modules: %modules.', array('%path' => $file->uri, '%modules' => implode(', ', array_keys($references))), WATCHDOG_INFO);
-      }
-    }
-  }
-
   $cache_bins = array_merge(module_invoke_all('cache_flush'), array('form', 'menu'));
   foreach ($cache_bins as $bin) {
     cache($bin)->expire();
diff --git a/core/modules/system/tests/registry.test b/core/modules/system/tests/registry.test
index 7ad8326..987311d 100644
--- a/core/modules/system/tests/registry.test
+++ b/core/modules/system/tests/registry.test
@@ -69,7 +69,7 @@ class RegistryParseFilesTestCase extends WebTestBase {
       $this->$fileType->className = 'registry_test_class' . substr($chrs, 16, 16);
       $this->$fileType->interfaceName = 'registry_test_interface' . substr($chrs, 32, 16);
       $this->$fileType->contents = $this->getFileContents($fileType);
-      file_save_data($this->$fileType->contents, $this->$fileType->fileName);
+      file_unmanaged_save_data($this->$fileType->contents, $this->$fileType->fileName);
 
       if ($fileType == 'existing_changed') {
         // Add a record with an incorrect hash.
diff --git a/core/modules/update/update.info b/core/modules/update/update.info
index 0dfda0a..2fb657e 100644
--- a/core/modules/update/update.info
+++ b/core/modules/update/update.info
@@ -4,3 +4,4 @@ version = VERSION
 package = Core
 core = 8.x
 configure = admin/reports/updates/settings
+dependencies[]=file
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPermissionsTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPermissionsTest.php
index 58fdf6b..43f43e3 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserPermissionsTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserPermissionsTest.php
@@ -77,6 +77,8 @@ class UserPermissionsTest extends WebTestBase {
     // permission is assigned by default.
     $edit = array();
     $edit['modules[Core][aggregator][enable]'] = TRUE;
+    // Aggregator depends on file module, enable that as well.
+    $edit['modules[Core][file][enable]'] = TRUE;
     $this->drupalPost('admin/modules', $edit, t('Save configuration'));
     $this->assertTrue(user_access('administer news feeds', $this->admin_user), t('The permission was automatically assigned to the administrator role'));
   }
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 4217234..787def9 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -1,8 +1,8 @@
 <?php
 
 use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\Core\File\File;
 use Drupal\entity\EntityInterface;
+use Drupal\file\File;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 
 /**
