Force file download with header

From: Date: Mon, 06 Jan 2003 21:23:57 +0000
Subject: Force file download with header
Groups: php.general 
Request: Send a blank email to php-general+get-130493@lists.php.net to get a copy of this message
Hi, Here is the simple script with which I am trying to have the user to download a file when the file name is posted from the user agreement page. dlQ_safe.php <? $file = $_POST[fileID]; $files_folder = "C:\\temp\\"; $dlfile = $files_folder.$file; header("Content-type: application/pdf"); readfile("$dlfile"); ?> When a file submitted I get this... "Warning: readfile("C:\temp\test.pdf") - No such file or directory in c:\inetpub\wwwroot\dlQ_safe.php on line 10" The test.pdf file is of course there... What do I need to add to this script so that whatever a pdf filename is submitted, acrobat will open this file in the user's browser? Thanks

« previous php.general (#130493) next »