media->save gives erros
instead of this part of the array

$file_name =&gt; [ 'target_id' =&gt; $fid, 'alt' =&gt; $title, 'title' =&gt; $title, ], ]);


i had to put the field name , not the file name.

'field_document' =&gt; [ 'target_id' =&gt; $fid, 'alt' =&gt; $title, 'title' =&gt; $title, ], ]);