My Drupal version is 8.6.10
I am trying to upload a file through the file_save_upload function and the function is looking for the file in
Symfony\Component\HttpFoundation\FileBag Object
$all_files = \Drupal::request()->files;
debug($all_files);
Symfony\Component\HttpFoundation\FileBag Object
(
[parameters:protected] => Array
(
)
)
But my file is in
Symfony\Component\HttpFoundation\ParameterBag Object.
$all_files = \Drupal::request()->request;
debug($all_files);
Symfony\Component\HttpFoundation\ParameterBag Object
(
[parameters:protected] => Array
(
[name] =>
[type] => 4
[files] => Array
(
[image_section] => logo_capnord.png
)
[op] => Ajouter
[form_build_id] => form-wMTrCGaN5mPlOOv8bqS7UsJ0lRiSN6QQp9UviA0cTIA
[form_token] => 1hTMXJRfoQvFV9Lqq3TuJ29eYC6L-zt3U7Bow1P8yJ0
[form_id] => capnord_section_form_list
)
)
The field is generated through the reloading of the form in ajax.
$form["base"]["fields"] += [
"image_section" => [
"#type" => "file",
"#title" => "Image",
]
];