Insert a file into PostgreSQL BYTEA field using PHP The previous answers have been horribly complex for the scope of this project.
I want to take the $_POST result as a variable and insert it into a BYTEA field of a table.

$_SESSION['username'] = $username;
$file = $_POST["file"];


file is the file itself submitted from the form on the previous page

pg_prepare($conn, "register_user_info", 'INSERT INTO fileDB.assignment(pawprint, name, number, section, file) VALUES ($1, $2, $3, $4, $5)'); 
pg_execute($conn, "register_user_info", array($username, "1", "1", "1", $file));


I need to insert the file itself into the file column of my database. How can I make this happen?
Your options are:


Use PDO, which properly supports binary parameters; or
Use pg_escape_bytea with string substitution into the query text.


See https://stackoverflow.com/q/17121791/398670 .