"shapper" wrote ...
Should I separate the create a document and upload a document (file)?
I wrote a document management application for work, the approach I took was
that you create a "virtual" document in your database, storing an id, title,
publication date, review date, obsolete date, owner, etc etc, and then you
upload the file. I saved the file to our storage area with a unique id from
the database (from the files table), for example 1.doc, 2.pdf etc etc,the
database ties the files to the documents. With this approach, if you wanted
to give a URL to a document you could ensure that they always received the
most recent version of the document with having to change the URL for
example: download.aspx?docid=nnn, when this is requested it can then look up
the most recently attached file. As you upload each new file (version) you
just flag it as the most recent version and shuffle the others down
effectively.
To answer your numbers questions..
1. As above
2. I gave the ability to display a form which also had the "Browse" file
select box, but if they didn't choose a file it was the determined that they
were just updating the virtual document details, for example updating the
owner, or publication date, or a typo, but there was no need to add another
file. If they did add another file then it assumed a new version and would
shuffle the others down accordingly...
3. I chose to never delete anything, we flag the virtual documents/files
as deleted in the database and dont return them in the search results, but
we never delete the data or files, I work for the NHS (National Health
Service/UK) - and there maybe a legal reason why we may need to produce a
document in the future etc.
Maybe I should have a table with all files and every time I upload a
file I would add a record to that table.
Thats what I did..
And then when I create a document I would insert its information and
select one of the uploaded files.
Yep..
Anyway, what is usually the best way to do this?
Thats worked for us for the last 4 years, currently have around 5000+
documents stored, user base in the thousands...
Regards
Rob