Hello!
I have some postgresql database that stores binary data (windows/linux
executables). Field type I use for this is bytea.
Also I have php script that allows users download these binaries via
their web browser.
That stuff was running on ubuntu 7.10 with postgresql 8.2 and most
recent php version.
That was written like this:
$db_con = pg_connect(...) ;
/*determine file name (rg_target) and file
size (l) with postgres' octet_length*/
header('Content-type: application/octet-stream');
/*header("Conten t-length: $l");*/
header("Content-disposition: attachment; filename=$rg_ta rget");
pg_free_result( $db_res);
$db_res = pg_query(..)
or die('Error executing query: ' . pg_last_error() );
$rg_binary = pg_fetch_result ($db_res, 'rg_binary');
echo pg_unescape_byt ea($rg_binary);
pg_free_result( $db_res);
pg_close();
exit();
and that worked (with commented content-length) in ff and ie.
Then I've upgraded to ubuntu 8.04, postgres 8.3 and this code became
broken: when downloading file, only first ~175 kbytes get downloaded.
File in database, say, 4MB and user can download only first 175 kbyte
chunk.
I have some postgresql database that stores binary data (windows/linux
executables). Field type I use for this is bytea.
Also I have php script that allows users download these binaries via
their web browser.
That stuff was running on ubuntu 7.10 with postgresql 8.2 and most
recent php version.
That was written like this:
$db_con = pg_connect(...) ;
/*determine file name (rg_target) and file
size (l) with postgres' octet_length*/
header('Content-type: application/octet-stream');
/*header("Conten t-length: $l");*/
header("Content-disposition: attachment; filename=$rg_ta rget");
pg_free_result( $db_res);
$db_res = pg_query(..)
or die('Error executing query: ' . pg_last_error() );
$rg_binary = pg_fetch_result ($db_res, 'rg_binary');
echo pg_unescape_byt ea($rg_binary);
pg_free_result( $db_res);
pg_close();
exit();
and that worked (with commented content-length) in ff and ie.
Then I've upgraded to ubuntu 8.04, postgres 8.3 and this code became
broken: when downloading file, only first ~175 kbytes get downloaded.
File in database, say, 4MB and user can download only first 175 kbyte
chunk.
Comment