I wrote this a while ago for a pipe-delimited file download

function force_download($file)
{
//$dir="/path/to/file/";
if (isset($file)) {
header("Content-type: application/force-download");
header('Content-Disposition: inline; filename="' . $file . '"');
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header('Content-Type: application/octet-stream');
//header("Content-disposition: attachment; filename="".basename($file).""");
header('Content-Disposition: attachment; filename="' . $file . '"');
readfile("$file");
} else {
echo "No file selected";
} //end if


}//end function

the parameter for the function s the filename


bastien

From: "Lens Man" <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Subject: [PHP-DB] Saving Data to a csv file
Date: Thu, 10 Mar 2005 18:53:16 +0100 (MET)

Hi,

I'm trying to make a downloadable csv file from a address database based on
PHP and MySQL.
I have a script for getting the data (no problem so far) but I want to have
the data delivered as a starting downlaod in csv format.
Can anyone give me a helping hand?

Thx in advance

Lensman

--
DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
AKTION "Kein Einrichtungspreis" nutzen: http://www.gmx.net/de/go/dsl

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to