thedp
thedp

Reputation: 8508

CodeIgniter: Storing an image in the database?

I would like to store images in my mySQL database using the CodeIgniter PHP framework. How do I write and read the image?

Thank you.

Upvotes: 0

Views: 5612

Answers (2)

Rex Morgan
Rex Morgan

Reputation: 3029

It's considered bad practice to store the actual image files directly in a database. Instead you can just store a path to the file in the database and store the file in a directory on the server.

AstaHost Forums

Best approach for storing uploaded image

CodeIgniter - Uploading an Image through a form, store the location of the image in database

Upvotes: 3

Sarfraz
Sarfraz

Reputation: 382666

You will have to use the file uploading class of CI to upload the files and use the models to save them to the database, here are related resources:

File Uploading Class
Models

Upvotes: 4

Related Questions