By mohit_aghera on
Change record status:
Draft (View all draft change records)
Project:
Introduced in branch:
11.4.x
Issue links:
Description:
A new service has been added in FileSystem at Drupal\Core\File\UploadedFilesExtractor
This service provides a central point to extract uploaded files from the request.
Before
$all_files = \Drupal::request()->files->get('files', []);
if (empty($all_files[$upload_name])) {
return FALSE;
}
$file_upload = $all_files[$upload_name];
After
$file_upload = \Drupal::service(UploadedFilesExtractor::class)->extractUploadedFiles($upload_name);
Here $upload_name is the name of file upload field in form.
Impacts:
Module developers