jeudi 3 septembre 2020

How to add an UploadedFile to $request->files manually

I want to upload a file which is already there in storage directory using code I want to merge that with my request.

How can I upload a file by code by passing $request->file manually to request?

Below code I am using to pass file manually but in controller I am not able to receive that file using $request->file('image').

$data=[
'image'         => new \Illuminate\Http\UploadedFile(storage_path('listing-demo/1.jpeg'),'1.jpeg'),
'input1' =>'output1',
'dummy2' =>'output2',
]

$request = new \Illuminate\Http\Request();
$request->replace($data);

app(MyRepo::class)->insert($request);

In My repository file I am not able to access file using $request->file('image').



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire