I am trying to make an online kickstart config file creator. After the file is created on the server how do I get the download dialog to pop up so the user can download it?
By using the HTTP header Content-Disposition: attachement, you can also supply or add a recommended filename to be displayed by the download dialog box. This is done using a concatenated filename attribute. When no filename is specified, the current script filename is used.
To Download PDF from HTML link using PHP with the help of header() function in php. The header()function is used to send a raw HTTP header. Sometimes it wants the user to be prompted to save the data such as generated PDF. header("Content-Length: " .
$file; // Process download if (file_exists($filepath)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($filepath) .
Content-Disposition header..
// We'll be outputting a PDF
header('Content-type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The PDF source is in original.pdf
readfile('original.pdf');
http://au2.php.net/manual/en/function.header.php
the magic is in the content-disposition
send a file to client
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With