Saving Picutures into MySql
-
I understand that there are conflicting opinions on saving pictures directly in the database but I want to put a picture of an item on a table so the person that is cataloging the data can have a visual reference when selecting the type of item. It will be like having the employee table store the picture of the employee. The main data table will not store the pictures.
If I have the file either on my disk or a link on the internet, what will be the easiest way to upload the picture to the database.Thanks for the help,
-
I understand that there are conflicting opinions on saving pictures directly in the database but I want to put a picture of an item on a table so the person that is cataloging the data can have a visual reference when selecting the type of item. It will be like having the employee table store the picture of the employee. The main data table will not store the pictures.
If I have the file either on my disk or a link on the internet, what will be the easiest way to upload the picture to the database.Thanks for the help,
@Dan3460 said:
If I have the file either on my disk or a link on the internet, what will be the easiest way to upload the picture to the database.
Read the whole file as binary, and insert it in the db as you'd do any other field. However, when showing it you'd need to know what type the data is (i.e. jpeg, png etc,) so it's a good idea to keep in the db also the mime type and optionally the size.
Kind regards.