Ratings | | Unique User Downloads | | Download Rankings |
Not enough user ratings | | Total: 259 | | All time: 7,826 This week: 26 |
|
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. Innovation Award
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 |
| |
|
|
Innovation award
Nominee: 23x
Winner: 2x |
|
Recommendations
Example
<?php
require_once('config.php');
ini_set("max_execution_time",9999);
// ini_set('upload_max_filesize','1024M');
// ini_set('post_max_size','1024M');
require_once('BFile_WithPDO.php');
?>
<!doctype html>
<html>
<head>
<title>Test for PHP BFile_WithPDO</title>
</head>
<body>
<h1 align="center">Test for PHP BFile_WithPDO</h1>
<hr>
<?php
echo'<pre>';
echo '<h2>Uploaded file</h2>';
if( isset( $_POST ) && $_SERVER['REQUEST_METHOD'] == 'POST' ) {
BFile_WithPDO::add($bdd,$x=$_FILES[ 'file' ]['name']);
}
?>
<form Action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Submit">
</form>
<?php
if(isset($_FILES['file']['type'])){
echo'<h2>reading '.$_FILES[ 'file']['name'].'</h2>';
if(substr($_FILES['file']['type'],0,6)=='audio/'){
?> <audio src="file.php?id=<?php echo $x;?>" controls="controls">upgrade your browser to enjoy this</audio>
<?php
}elseif(substr($_FILES['file']['type'],0,9)=='video/mp4'){
?>
<video src="file.php?id=<?php echo $x;?>" controls="controls">upgrade your browser to enjoy this</video>
<?php
}elseif(substr($_FILES['file']['type'],0,6)=='image/'){
?>
<img src="file.php?id=<?php echo $x;?>"/>
<?php
}else{
echo 'format non readable';
}
}
?>
<hr>
</body>
</html>
|
Details
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 leizmo@gmail.com.
PS: to handle the very large file (>2Mo) you will need to setup your PHP.ini file for
max_execution_time
upload_max_filesize
post_max_size
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
|
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.