fabricecw's avatar

AngularJS POST File-Upload to Laravel

Hi

I'm building an angularjs application with laravel as the backend. Does someone know how to upload a file (or in future multiple files with d&d) and get it in the laravel backend to check the file and store it? I also need the original name of the uploaded file...

I've already created the route, the controller and the upload method...

Can someone help me? Many thanks!

0 likes
3 replies
fabricecw's avatar

Hi Bloomanity

Thanks, upload works now (problem was the AngularjS frontend...). But bigger problem for me is the download:

return response()->make(Storage::get($filepath), 200, [
            'Content-Type' => Storage::mimeType($filepath),
            'Content-Disposition' => 'attachement;'. $filepath,
        ]);

The API returns just a path /tmp/xxxxx but doesn't download the file. I'm pretty sure that I have to start the download in the AngularJS frontend... Someone know how to do this? I tried some solutions, but nothing works...

Thanks for your help!

Please or to participate in this conversation.