Post form data to mysql table including images

You would have the additional overhead if storing in the database of having to convert the file to a blob when you store it and to convert it back to a file when you retrieve it. So storing it separately would possibly be slightly faster.

It really depends on whether you require database features such as data integrity and access control to be applied to the image. If the image is only supposed to be accessed by people who are logged in then the only way to enforce that is to store the image in the database - if it is stored separately then it can be accessed directly by anyone who figures out its address whether they are logged in or not.

There are advantages and disadvantages both ways and you need to make the decision on which way to go based on which way works the best for your particular requirements.

If you do decide to insert the images into your mySQL database in order to make use of the database management features then defining a field as a MEDIUMBLOB will allow for images up to 16Mb in size.

You could then update that field using

UPDATE tablename SET imagefieldname = LOAD_FILE('theimage.jpg') WHERE ...

and retrieve it back into a file using

SELECT imagefieldname INTO DUMPFILE 'tempimage.jpg' FROM...

alternatively you can set up PHP that is generating the image and simply output the content of the blob after writing the appropriate headers.