Skip to content
Advertisement

How to save csv file in /public folder using laravel?

I am trying to save a csv file and download it. To download I used the following code.

JavaScript

The variables $header, $data and $filename can be different based on the program. However, this only takes care of the download portion. I want to save the csv file before downloading it. How can I do that?

Advertisement

Answer

I didn’t find any laravel specific solution. But I solved it using raw PHP.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement