PHP Classes


Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Ahmed Shreef  >  Shref Image in DB  >  >  Download  
Role: Example script
Content type: text/plain
Description: example on adding image to db
Class: Shref Image in DB
Store and retrieve binary files in a MySQL table
Author: By
Last change:
Date: 10 years ago
Size: 602 bytes


Class file image Download

//this example uses class Shref_ImgInDb to save an image to data base

// first we included the class in the file
require_once "Shref.ImgInDb.class.php" ;

//then created a new object
$Shref = new Shref_ImgInDb() ;

//**conected to the data base
// user : root
// pass :
// db name : test

//added the image to the data base
//the image path : linux.jpg
//the table in data base that we will save the image in : imageData
//the column where we will save the image : image
$Shref->addImage("linux.jpg", "imageData", "image");