<?php
function charge_photo() {
   if ($filename = $_FILES[photo][tmp_name]) {
       $fd = fopen ($filename, "rb");
       $contents = fread($fd, filesize($filename));
       fclose($fd);
       return array("'" . pg_escape_bytea($contents) . "'", "'".$_FILES[photo][type]."'");
   } 
   return array ("NULL", "NULL");
}
?>