ah, the good old "binary data in DB or FS" dilemma!
I've taken the "link in DB, file in FS" path up to now, and I've faced two annoying issues:
- sooner or later there are going to be inconsistencies: someone will mess with the files without updating the DB record
- backing up or migrating even a couple million 50kb-sized files takes f-o-r-e-v-e-r!
but then again, there are valid reasons for not storing your binary data inside the RDBMS. you really need to know what you're doing and what that means when going down that path.
I've been working on a document management project that attempts a compromise between the two: store the data in an sqlite-based VFS storage structure that is accessible through a postgresql database session. there's going to be much more, but this part alone might be of interest to some.
if you're feeling adventurous, you can check out the project here
you can find an example application for the VFS engine here
if you decide to use pdstorage for your project, let me know of any questions.