Erich Beyrent wrote:

Use the BLOB, Luke!

See your local MySQL manual for details.

We're using BLOBs to store PDF in our database, and through the use of


HTTP

headers, we're able to let user download the PDFs without having to


store a

local copy on disk, directly from the database (content-disposition header).



Hi Kurt,


I have been using MySQL to store links to PDFs which live in other
directories.


Is there an advantage to storing the PDFs directly into the database?

-Erich-



Not all PDF's are viewable for all users. First it is determined whether the user can be granted access to the file, before he's presented with a hyperlink. This authorization is stored in the database, thus our web app can access and present the PDF using the same protocol it used for authentication/authorization. It can even use the same open database connection. No need to deal with other protocols and protection/authorization of those files on file system- and web server-level: if you're not authorized, you can't access them in any way. Backoffice maintenance and content management can be done with only a single database connection. In our case, this resulted in much simpler and safer code.

Other advantages I can think of are, amongst other, master/slave replication of the database, and no required needs to tune your database server for anything else than MySQL activity. Disadvantages which come to mind are a much larger database, which is often more difficult to maintain than large file systems. To some people, at least. Just ideas, food for thought.

Regards,
Kurt.

Reply via email to