I have faced this problem twice and each time I elected to put them in the
file system and then have some table that tracks filenames and associates to
an object in the database. Obviously you lose referential integrity but it
is possible to write a little program that checks that a row in the table
exists for each file name and a filename exists for each row in the table.
On one project we have 12GB of files and the database is only 500meg in
size. The management of the DB would have been more difficult if all of the
files were stored in it.
If you have a lot of files it is important to choose a good naming scheme
and directory structure. Our scripts automatically create a directory per
year per month per day of month. ie Files\2005\04\31\ In that way no one
directory becomes too large.
Backing up the data is also a breaze - xcopy.
You have to structure the transaction during the upload. If you start a
transaction, wait for the file to upload, add it to the database, add it to
the file system and then commit the transaction then you will have some long
running locks. Be careful that if the file does not upload correctly then
everything is clean up as expected.
There is some more code to write to manage the files and directories and the
database but it is a solution that works well.
I hope this helps. Feel free to contact me if you want more information (or
even code)
Dave A
> Hello,
>
[quoted text clipped - 9 lines]
>
> Thanks.
IkBenHet - 31 May 2005 07:46 GMT
Hello Dave,
Thanks for your clear answer! So, basically it is integrity that you
can lose if the script is not structured in a good way. Of course some
reference code is welcome. Was is all done in ASP.NET? You can sent it
to my e-mail adres.
Thanks.