// output up to 5MB is kept in memory, if it becomes bigger it will // automatically be written to a temporary file $csv = fopen('php://temp/maxmemory:'. (5*1024*1024), 'r+'); fputcsv($csv, array('blah','blah')); rewind($csv); $output = stream_get_contents($csv); // Put the content directly in file into the disk Storage::disk('myDisk')->put("report.csv", $output);