What are the pros and cons of storing files in a database?

database, file, mysql, php

Solution

Pro: highly portable.

Con: you can't do anything with it using SQL (indexing, searching, etc) and you'll need to add metadata in other columns (content type, filename, etc) to improve (re)usability and maintainability.

I wouldn't do that. The disk file system is much better suited system for those tasks.

Problem

I'm writing a php application and was wondering if it's a bad idea to store complete files in the database. Files should be around 100-200kb mostly text files (txt, doc, docx and so on) or small image files. Or is it just a plain wrong idea?

Original source

Related problems