file size calculation question
Posted: Tue Jun 24, 2008 9:37 pm
I'm dynamically creating a file by reading data from a database table. The data is stored in the table as a serialized array. Based on certain criteria, the query which gets the data from the table may return multiple rows; hence the resulting variable that holds this data is itself an array. I then spit the contents of this variable to the browser like so:
My question is, how do I calculate the value for $size??
Code: Select all
<?
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"file-name.txt\"");
//header("Content-length: $size");
foreach($buffer as $indata)
{
foreach(unserialize(stripslashes($indata)) as $rdata)
{
echo $rdata."\n";
}
}
?>