I have an anchor tag:
<a href="file.pdf">Download Me</a>
I would like for the user to click on it and then have a Save-As dialog box appear with a new filename I determine.
I found this(http://www.w3schools.com/php/func_http_header.asp):
header("Content-type:application/pdf");
// It will be called downloaded.pdf
header("Content-Disposition:attachment;filename='downloaded.pdf'");
// The PDF source is in file.pdf
readfile("file.pdf");
I don't understand where to put those headers. At the top of the page? When I try to place those 3 lines directly above my link I receive the following errors:
Warning: Cannot modify header information - headers already sent by (output started at /home5/ideapale/public_html/amatorders_basic/admin/download.php:38) in /home5/ideapale/public_html/amatorders_basic/admin/download.php on line 118
I got the same error for both of the header lines I just added. Right after that, there are thousands lines of ASCII letters. How can I get the Save-As dialog box to appear using either jQuery or PHP(whatever is easier)?