force download with header()

From: Date: Sun, 08 Dec 2002 15:07:26 +0000
Subject: force download with header()
Groups: php.general 
Request: Send a blank email to php-general+get-127432@lists.php.net to get a copy of this message
i was reading about php.net looking for a way to force a download of a txt file, rather than the browser displaying the file. i ran into header() that seems to be able to accomplish it... but seeing as i'm very much a newbie at php, i can't seem to make this work if the file i want to download is nfo/60/ind.txt how would i impliment this: <?php // 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'); ?>

« previous php.general (#127432) next »