Is it possible to store a file (such as an image, pdf file, mp4 video file, etc.) in a SQL database, and then call that file back out of the database to use in web content? If so, how do you do this?
Is it possible to store an image, pdf, video, etc. in a SQL database?
Collapse
X
-
Tags: None
-
Yes. In most SQL databases you can store the images, pdfs and videos directly into the database in their binary format.
To do this you would use a BLOB ( binary large object ) column type to store the file data in.
Example table:
Code:mysql> create table product ( product_id BIGINT PRIMARY KEY, product_name VARCHAR(50) NOT NULL, photo BLOB NOT NULL ) Engine = InnoDB;
niheel @ bytes
Comment