I uploaded a file to the postgresql database with the OID column type. With the code below I can view / open the file in the browser, but I intend to download and / or print this same file on the printer with php. The files will be of any extension.
$query= pg_query($dbconn,"select * from tabela") or die(pg_last_error($dbconn));
$queryRow= pg_fetch_assoc($query);
$file = $queryRow['doc'];
pg_query($dbconn, "begin");
$handle = pg_lo_open($dbconn, $file, "r");
pg_lo_read_all($handle);
pg_query($dbconn, "commit");