function file_managed_file_save_upload

Same name and namespace in other branches
  1. 10 core/modules/file/file.module \file_managed_file_save_upload()
  2. 7.x modules/file/file.module \file_managed_file_save_upload()
  3. 9 core/modules/file/file.module \file_managed_file_save_upload()
  4. 8.9.x core/modules/file/file.module \file_managed_file_save_upload()

Saves any files that have been uploaded into a managed_file element.

Parameters

array $element: The FAPI element whose values are being saved.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array|false An array of file entities for each file that was saved, keyed by its file ID. Each array element contains a file entity. Function returns FALSE if upload directory could not be created or no files were uploaded.

Deprecated

in drupal:11.5.0 and is removed from drupal:13.0.0. Use \Drupal::service(ManagedFileElementHelper::class)->managedFileSaveUpload() instead.

See also

https://www.drupal.org/node/3382414

File

core/modules/file/file.module, line 174

Code

function file_managed_file_save_upload($element, FormStateInterface $form_state) {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Use \\Drupal::service(ManagedFileElementHelper::class)->managedFileSaveUpload() instead. See https://www.drupal.org/node/3382414', E_USER_DEPRECATED);
  return \Drupal::service(ManagedFileElementHelper::class)->managedFileSaveUpload($element, $form_state);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.