I have setup a download to a pdf file via a file handle and then write it out as follows ( with some suitable headers )
$stream = new \Slim\Http\Stream($fh);
$response = $response->withBody($stream);
/* cannot delete / unlink here */
however I want to delete the file but can’t as the response needs it.
I’m not sure the best approach here ?
- scheduled a task to delete the file
- find a different way to write to the response so that the file can be deleted
any help much appreciated