How to insert images into a database using PHP [closed]

Generally the best way to do this, is to upload the file to your server, and then store the path to it in the database.

File Upload:

You need to choose a database, MySQL is a common and free option:

As mentioned in comment below, (I haven’t used it before but had a read and looks like a better option)

PDO (recommended library to use with several types of databases):

Note that there are many security considerations when letting people upload files to your server:

All in all, it may be longer than you think before your friend is uploading that file – but it will be worth it

Leave a Comment