I am reading two image files and storing into psql. When I read one file, the code doesn't raise error. When I add code for other file, the code starts complaining 'Uncaught ReferenceError' about one script at the end of the html.
Here is my code. Is this correct way to read two image files or there is some problem the way I am trying to read the files.
if(isset($_POST["submit1"])){
$file_name = $_FILES["img1"]["tmp_name"];
$img = fopen($file_name, 'r') or die("cannot read image
");
$data = fread($img, filesize($file_name));
var_dump($file_name);
$es_data = pg_escape_bytea($data);
fclose($img);
$file_name2 = $_FILES["img2"]["tmp_name2"];
$img2 = fopen($file_name2, 'r') or die("cannot read image
");
$data2 = fread($img2, filesize($file_name2));
var_dump($file_name2);
$es_data2 = pg_escape_bytea($data2);
fclose($img2);
try {
$sql .......................