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!