How to get a file from DB

I have a table with a blob column for images. I found in doc how to upload a file, but there is no info about how a user can download it.

You basically will fetch the data from the DB then you’ll output a header to tell the browser the type of data it’s receiving then output the data you pulled from the DB.

here’s a link on how to output images using PHP you should be able to see where to make changes to use the data from the DB rather than a file.

How to Output Images using PHP?

how to get the value from the database to display the value in dropdownlist in yii?