PhpRiot
Follow phpriot on Twitter
Sponsored Link
Download Article
Download this article in PDF format with all listings and files.

Price: $5.00 AUD
(Approx. $5.00 USD)

More information
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store
Free iPad/iPhone App
Available on the App Store

  • PHP manual
  • Zend Framework manual
  • Smarty manual
  • PHP articles
  • PHP training

Storing Images In MySQL

Note: This article has been replaced by Storing Images in MySQL Revisited (by Quentin Zervaas, 2010). We've left this article here for historical purposes, but we strongly recommend you use the newer article instead.

Introduction

This article is an introduction to using the blob column type in MySQL. The concept is introduced by familiarising users with uploading and storing images in a MySQL table.

Definitely a controversial topic in PHP-land, but at least knowing how to do it will help you make a decision on whether or not it’s for you.

The article covers the following:

  • Isn’t this a bad idea?
  • What is a BLOB?
  • Creating an image table
  • The upload form
  • Uploading the image
  • The upload() function
  • Display an image from the database
  • Displaying all the information

This article was originally published at http://phpro.org, and is reproduced on PhpRiot with permission of the author, Kevin Waterson.

In This Article


Article History

Jun 19, 9804
Initial article version
Jan 18, 2008
Updated listing 5 to not include non-existent conf.php