A
A
akdes2017-08-08 17:33:37
Laravel
akdes, 2017-08-08 17:33:37

How to accept multiple files from AngularJs in Laravel?

Hi everybody.
I made a "point" for downloading files in Lara.

public function store(Request $request)
{
        $file = $request->file('content');
        dd($file); //path to tmp/file.extension
}

Everything works great, but as soon as I upload several files, the request cools down.:

Request Payload (Chrome Dev-Tools)
------WebKitFormBoundary3QeBp3B4d9KICAF5
Content-Disposition: form-data; name="content"; filename="COKE1.jpg"
Content-Type: image/jpeg
------WebKitFormBoundary3QeBp3B4d9KICAF5
Content-Disposition: form-data; name="content"; filename="coke.png"
Content-Type: image/png

and only coke.png comes, i.e. the last file in the list.
Can you please tell me how to get all sent files?
Without touching Angular if possible... ie. with additions to Laravel
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2017-08-08
@Alex_Wells

foreach($request->file('content') as $file)
JS:
http://localhost/nested/url?content[]=files

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question