note 59389 rejected from function.header by nlopess

From: Date: Mon, 05 Dec 2005 18:23:38 +0000
Subject: note 59389 rejected from function.header by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-99597@lists.php.net to get a copy of this message
Note Submitter: luizfbarbosa at gmail dot com ---- I trying to download a file wtih the code below, but every time the file size it's 4 Kb. What I'm doing wrong? <? $con = odbc_connect("Download","","") or die("Error"); $sql = odbc_exec($con,"SELECT * FROM downloads Where DownloadID=1"); while(odbc_fetch_row($sql)) { $data = odbc_result($sql,"DownloadFile"); $size = odbc_result($sql,"DownloadSize"); $name = odbc_result($sql,"DownloadFileName"); $filecontent= odbc_result($sql,"DownloadDescription"); header("Content-disposition: attachment; filename=$name"); header("Content-Type: application/force-download"); header("Content-Transfer-Encoding: binary"); header("Content-Length: $size"); header("Pragma: no-cache"); header("Expires: 0"); echo $data; } ?> TIA

« previous php.notes (#99597) next »