I wonder how can I send temp file in Laravel or with php funciotn. I know that tmp file exist to the end of script or to its close time.
I'm crating tmp file with this function tmpfile();
I tried to send tmp file with
$headers = [
'Content-Type' => 'application/pdf',
];
return response()->download($tmpfile, 'tmp_name.pdf', $headers);
But I got error The file \"Resource id #968\" does not exist
What I miss misunderstand or what I'm doing wrong? Should I first get file content for example by File::get($tmppath) and then return in response file content?