note 59389 added to function.header

From: Date: Mon, 05 Dec 2005 17:43:58 +0000
Subject: note 59389 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-99595@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59389 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59389&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59389&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59389&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59389&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59389&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59389&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59389&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59389&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99595) next »