Is it possible to store an Image file (.jpg, .gif, etc) in MYSQL database? Or do it just stores in system and takes reference path of image?
I am using ASP.NET C#, so if you have sample code, it would be great if you could share it.
Yes, you can store image files (and any other files) in a database as binary data.
In MySQL, the BLOB
data type can be used to accomplish this.
A BLOB is a binary large object that can hold a variable amount of data. The four BLOB types are TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB. These differ only in the maximum length of the values they can hold. [...]
BLOB values are treated as binary strings (byte strings). They have no character set, and sorting and comparison are based on the numeric values of the bytes in column values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With