file($filename) or die ('Cannot determine file type'); // This says for an mp3: audio/mpeg; charset=binary // should be good to go pg_query_params ("update filelog set downloads = downloads+1 where filename=$1", array($filenameonly)); pg_close(); header ("Content-Type: $type" ); //declare content type while ($b = fread($f, 4096)) echo $b; // sent the bytes off fclose($f); ?>