PHP Classes

Handle Binary Files With PDO: Save and load binary files in databases using PDO

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 238 This week: 1All time: 7,970 This week: 429Up
Version License PHP version Categories
hbf-with-pdo 1.0The PHP License5PHP 5, Databases, Files and Folders
Description Author

This class can save and load binary files in databases using PDO.

It can execute SQL queries using PDO to update a database table record with a LOB field that holds binary data.

The class can also execute a query that retrieves a LOB field value of a given record.


file php class pdo
I need manipulate files

Store PDF as binary in Database and read it as PDF or HTML
I want to convert PDF file in Binery

Video upload script in php5.6
I need a video upload script with size limit in PDO or Mysqli

Play or download wav file from MySQL
Play or download wav file from MySQL without writing to disc.

Using PHP 7 Insert image in the MySQL database and display
Insert image in a MySQL database

What is the best PHP upload files to database class?
Upload doc and pdf documents to a database using php

Innovation Award
PHP Programming Innovation award nominee
December 2017
Number 4
PDO is a PHP extension that can be used to access data in many types of SQL databases.

This package makes it easy to store and retrieve files in database large object table fields.

Manuel Lemos
Picture of zinsou A.A.E.Mose
  Performance   Level  
Name: zinsou A.A.E.Mose is available for providing paid consulting. Contact zinsou A.A.E.Mose .
Classes: 50 packages by
Country: Benin Benin
Age: 32
All time rank: 7291 in Benin Benin
Week rank: 84 Up1 in Benin Benin Equal
Innovation award
Innovation award
Nominee: 23x

Winner: 2x

Handle Binary Files With PHP DATA OBJECT  (HBF With PDO) is a very little package that allows
users to handle files directly in and from their databases instead of save them in another 
folder on the disc.This package used a basic feature of PDO to insert in any database 
that supports transaction and BLOB data type,binary files and also to retrieve them once needed.

The package is very little ,so i don't provide documentation but you can see a how to use example
in the file testBFILEWPDO.php

For bug reporting or other feel free to use the forum or contact me at

PS: to handle the very large file (>2Mo) you will need to setup your PHP.ini file for 
	but also your database ini file 
	for example mysql require in the my.ini file
	max_allowed_packet = 4000M//this value is just for example in 
	you must choose your own value according to your app need 
	you might also need to change the setting in the config.php file 
	and also the default allowed extensions and the max upload size allowed in the BFile_WithPDO.php
  • capture.png
  • capture2.png
  • capture3.png
  Files folder image Files  
File Role Description
Plain text file BFile_WithPDO.php Class class source
Accessible without login Plain text file config.php Conf. config file
Accessible without login Plain text file file.php Example example script
Accessible without login Plain text file lob.sql Data database sql file
Accessible without login Plain text file readme.txt Doc. readme
Accessible without login Plain text file testBFILEWPDO.php Example example script

 Version Control Unique User Downloads Download Rankings  
This week:1
All time:7,970
This week:429Up
For more information send a message to info at phpclasses dot org.