Storing files in a database as BLOBs ( Binary Large OBjects) takes a lot of resources to store and retrieve them from the database, and of course you need to output them with the correct MIME-type as the content header otherwise the output will appear corrupted.
There are of course good reasons for using BLOBs the oft-quoted one is security as the actual path to the file is never exposed to the end user. However for a local system this doesn't really apply.
It is simpler store the files on a drive and just have the path in the database as a string which you can then output as a link to the user.
So if your files are stored in a site relative folder called "documents" with sub folders for each filetype.
The table structure would then need;
ID document ID
Name Document Name
Type Document type (pdf, doc, docx, jpg etc)
filename Document filename
plus whatever else you need.
And you can have Users & Groups with access rights to certain files or folders, add categories to the documents and so on and you have the basis of a document management/retrieval system.
Just don't get sued by Xerox 
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|