Hi,
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?
Hi,
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?
Personally, I like the idea, especially if the DB stores them compressed or you compress them manually.
Among other things, it means you don't need to worry about unique names for files, which saves a lot of complexity.
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.
It really depends on the situation?
Having said that, I would lean toward some kind of filesystem for documents over a database.
Advantages:
Disadvantages: