Networking, Programming and Graphics Tutorials

How to send headers to user's browser with PHP [3/3]

If you want the user to be prompted to save the data you are sending, such as a generated PDF file, you can use the Content-Disposition header to supply a recommended filename and force the browser to display the save dialog.

<?php
header
('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="document.pdf"');
readfile('document.pdf');
?> 
To send authentication dialog to user use this code:

<?php
header
("WWW-Authenticate: NTLM");
?> 
Rate this tutorial:                    
Networking, Programming and Graphics Tutorials - How to send headers to user's browser with PHP [3/3] - Networking, Programming and Graphics Tutorials
RECOMMENDED TUTORIALS

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: