This may be a stupid question but I have to ask it.
I'm writing up a document management database and need to include word docs, excell etc. I've got the database set out nicely with one exception, I've failed to learn how documents are kept on databases.
I'm guessing there are two possibilities.
1st - Documents are stored wholely within the database as objects, if so what datatype is the field?
2nd - Links to the documents are stored as "char" or "varchar" and you point to a folder called etc/risk_management/docs/
Please alleviate my ignorance.
I store the directory location of the file in the database. All documents that are uploaded are placed in the htdocs/site/documents folder.
If I delete an entry in the database the record is erased along with the path to the document, but the document remains in the htdocs/site/documents folder.
How would I delete both the record and the document?
How would I delete both the record and the document?
I use PHP to do both. First I create/edit/delete (depending on what is needed) the document and then I update the record in the db to reflect the change. That way if the create/edit/delete wasn't succesful for some reason, my DB doesn't need to be updated and I can send myself an error msg telling me what failed and why.
If you are going to store files as blob objects, any changes you make to the doc will have to be uploaded via an admin tool that you create (basically just a password-protected form that enables file upload and puts the correct paths in the DB). The advantageis that you always go to the same place (same admin page) for all tasks.
If you store the docs as files, you only have to use the admin tool to create a new entry. The advantage is that to update the document (as long as it retains the same name), you will only need Word and an FTP client.
I don't know as I would say that either is easier (using PHP and MySQL), but you or the people you're doing this for may prefer one alternative or the other.
Tom
If you store the docs as files, you only have to use the admin tool to create a new entry. The advantage is that to update the document (as long as it retains the same name), you will only need Word and an FTP client.
You could also add an FTP uploader to the admin and forego having to use an external FTP client. This way the PHP Script would upload the doc and add the information to the db.