note 77478 rejected from function.header by cece

From: Date: Fri, 31 Aug 2007 11:54:21 +0000
Subject: note 77478 rejected from function.header by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-129930@lists.php.net to get a copy of this message
Note Submitter: mortengrigori AT gmail.com ---- Hello, I've being facing a problem using the "Content-Disposition" parameter, every I download a file the whole content of the page from where I download the file is "attached" to the end of the file. Follows the routine I've been using: if (isset($_GET['download']) && ($_GET['download'] >= 1)) { if ($_GET['download'] == 1) header('Content-type: application/doc'); else if ($_GET['download'] == 2) header('Content-type: application/rtf'); else if ($_GET['download'] == 3) header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="' . $_GET['file'] . '"'); readfile($_GET['file']); } Does anyone know a workaround? All the research I've done gave no answer. Thanx in advance.

« previous php.notes (#129930) next »