diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index a6fc3f6..a961ec6 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -743,13 +743,22 @@ function file_save_upload($form_field_name, $validators = [], $destination = FAL
     // Check for file upload errors and return FALSE for this file if a lower
     // level system error occurred. For a complete list of errors:
     // See http://php.net/manual/features.file-upload.errors.php.
+    $error_to_log = NULL;
     switch ($file_info->getError()) {
       case UPLOAD_ERR_INI_SIZE:
       case UPLOAD_ERR_FORM_SIZE:
         drupal_set_message(t('The file %file could not be saved because it exceeds %maxsize, the maximum allowed size for uploads.', ['%file' => $file_info->getFilename(), '%maxsize' => format_size(file_upload_max_size())]), 'error');
         $files[$i] = FALSE;
         continue;
-
+      case UPLOAD_ERR_NO_TMP_DIR:
+        $error_to_log = t('The file %file could not be saved because the server is missing a temporary folder.', array('%file' => $file_info->getFilename()));
+        break;
+      case UPLOAD_ERR_CANT_WRITE:
+        $error_to_log = t('The file %file could not be saved because the server is unable to write to disk.', array('%file' => $file_info->getFilename()));
+        break;
+      case UPLOAD_ERR_EXTENSION:
+        $error_to_log = t('The file %file could not be saved because a PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help.', array('%file' => $file_info->getFilename()));
+        break;
       case UPLOAD_ERR_PARTIAL:
       case UPLOAD_ERR_NO_FILE:
         drupal_set_message(t('The file %file could not be saved because the upload did not complete.', ['%file' => $file_info->getFilename()]), 'error');
@@ -763,12 +772,22 @@ function file_save_upload($form_field_name, $validators = [], $destination = FAL
           break;
         }
 
-        // Unknown error
+      // Unknown error
       default:
-        drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.', ['%file' => $file_info->getFilename()]), 'error');
-        $files[$i] = FALSE;
-        continue;
-
+        $error_to_log = t('The file %file could not be saved. An unknown error has occurred.', array('%file' => $file_info->getFilename()));
+        break;
+    }
+    if (isset($error_to_log)) {
+      // Use trigger_error() here so that the error will be reported to the
+      // screen depending on the site's error reporting level.
+      trigger_error($error_to_log, E_USER_ERROR);
+      // Unconditionally display a error message to the end user. This is a
+      // generic message since the errors that trigger this represent
+      // server-level problems that end users should not know about (and cannot
+      // fix by attempting the upload again).
+      drupal_set_message(t('The file %file could not be saved because of a server error.', array('%file' => $file_info->getFilename())), 'error');
+      $files[$i] = FALSE;
+      continue;
     }
     // Begin building file entity.
     $values = [
