views:

670

answers:

1

hi,

I wanted to know if I was uploading an image in codeigniter to a database what would be my

$config['upload_path']

all the examples I have seen are using the filesystem. I have articles in a db and would like to store images relating to articles in the db as well. Can anyone help?

+3  A: 

You can read this great article called Storing Images in Mysql.

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

But not to leave you empty handed, look into Blob, it's a data-type for colums in MySQL ( and various other dbms ). This will let you store data such as Images and other binary file-types.

The idea of storing files and images in the database is in general the same as storing them on the filesystem, the layer in-between upload and having the actual file is just different.

You cannot just set your upload-path and hope everything is solved, you need to get some dirt on your hands aswell!

Filip Ekberg