Forum Moderators: coopster
1/ Hardest method. Save the image in the database as type BLOB. Load the image file either from the upload, as normal, or from another disc location. Read the file into a variable using file_get_contents() or similar. You need to pay careful attention to the type of the file, either using $_FILE[whatever][type] which is e.g. "Image/gif".
Now, when you output the file, send a header("Content-type: Image/gif"); and then output the contents of the BLOB. It should work fine.
2/ Easier method. Just upload the file, save it to disk, but store the filename in the database.
3/ Easy, but not easiest method. Upload the file, save it to disk using a unique identifier as filename (i.e. the auto_increment column from mysql), then save the original filename in the mysql database.
The mysql people themselves recommend storing as a file and not as a blob in the db.
Note: You don't have to do *both*. Either get the id from the db, and always name your files $id.gif, or else save the name of the file in the db. Quite obviously, these are mutually exclusive techniques.