If you use filename='downloaded.pdf', some browsers will try to save the file with the quotes in the filename.
Single quotes do not interpolate variables in PHP. You have also failed to properly terminate the string, probably due to putting more single quotes inside it. Try: Header('Content-Disposition: attachment; filename="'.$_SESSION['name'].'.txt"'); Kolink also points out that you should use...
I've written a PHP script that handles file downloads, determining which file is being requested and setting the proper HTTP headers to trigger the browser
A set of PHP HTTP Headers for file downloads that actually works in all modern browsers (and for many different file types). Yay!
PHP file download for dynamic data. Sometime we ask visitors to download files from a web site.
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.
Путь к файлам прописывается так: dl_save.php?filename=file.mp3 Подсчет можно реализовать внутри этого php файла... хоть в бд пиши, хоть в файл
In Netscape the problem doesn't exist. For example: input: ... download.php?name=virtualdub_1.4.9.zip.
The cache control header is used to force the download for text files and other files even if they are opened by default inside your web browser.
When you are trying to download a file using PHP it´s important to take into acount the definition of de Header element. I have seen various examples where the people use a.