Answer the question
In order to leave comments, you need to log in
How to count BLOB from PostgreSQL via PDO?
There is a base, record format:
record id || sha1 || BLOB content || name || size || user id
Attempt to execute code:
$query = 'SELECT * FROM "table_name" WHERE "fUserId"=:userid';
$result = $DB -> prepare($query);
$result -> execute(array(
':userid' => $_REQUEST['userId']
));
$result -> bindColumn(3, $file['fContent'], PDO::PARAM_LOB);
$result -> bindColumn(4, $file['fName'], PDO::PARAM_STR);
$result -> bindColumn(5, $file['fSize'], PDO::PARAM_INT);
$result -> fetch(PDO::FETCH_BOUND);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $file['fName']);
header('Content-Transfer-Encoding: "binary"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . $file['fSize']);
fpassthru($file['fContent']);
Answer the question
In order to leave comments, you need to log in
Found the answer.
The solution was to make
Before starting SELECT
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question