Is there a simple way to create an empty temp .htm file on the server and send it to the user as download? I don't need to really create the file with fopen(), it's enough to just create it temporarily and send it to the user.
I need that for a website authentication. I found there is tmpfile() function within PHP, but it doesn't quite work for me yet. I am working on a Symfony project, maybe there are also a header function I don't know of.
All I need is:
$token = '12345';
$filename = $token . '.htm';
createatmpfile($filename);
header(send .htm file as download to the user);
Not sure how that works, but maybe my pseudocode above explains what I am looking for ..
EDITED:
That's how it works for Symfony2 (thanks Grad):
use Symfony\Component\HttpFoundation\Response;
Controller method:
public function generateAction() {
$response = new Response();
$response->headers->set('Content-Disposition', 'attachment; filename="'.$token.'.htm"');
return $response;
}