Adding the images to database MySQL by means of PHP
First of all I’d like to note that in order to store images in the database MySQL it is necessary to specify one of the fields of the table as a derivative from the type BLOB. Abbreviation BLOB means large binary object. Pattern of storage of BLOB data can have several options:
- TINYBLOB can store up to 255 bytes
- BLOB can store up to 64 kilobytes of information
- MEDIUMBLOB up to 16 megabytes
- LONGBLOB up to 4 gigabytes
To store the Image file in the database, it is necessary to read the file in variable and to create the query to add the data to the table. In my case the task was to add two images to the base by means of the form with the use of PHP. We have the form with two fields and button “Send”: