in reply to literally saving a file inside a database

As far as how to do it, for binary or text you make a blob or text type field in mysql. The storage requirements and maximum size are listed as:
TINYBLOB, TINYTEXT L+1 bytes, where L < 2^8 BLOB, TEXT L+2 bytes, where L < 2^16 MEDIUMBLOB, MEDIUMTEXT L+3 bytes, where L < 2^24 LONGBLOB, LONGTEXT L+4 bytes, where L < 2^32

From the Mysql dev manual. As far as putting the file into it, just store the data in a string and do an insert:
my $file = <FILE>; $dbh->do("insert into file_table set data = '$file'");

Of course using $dbh->do() is not the best way to accomplish this... but it's fast and to the point. I've used a database for storing files in one or two situations... it has to be just the right situation for it to be a good thing.

Something to take note of, and I mention it because it was something that bit me and took me a while to figure out why. Make sure that your max_allowed_packet is set to a sufficiently high number on both the client and server side if using mysql or else you'll have strange failures without much in the way of reasonable error codes to figure out why it was failing. I can't tell you what caveats there may be for other db's because I haven't used them, but for mysql, this one got me!