Save File

S

shapper

Hello,

On a application I am saving files to a few folders and for each one I
have a record on a database.
I rename most files so that the Id of the record becomes the filename.
But in some cases I don't.

For example, on my database should I have a column named Path which
could become:

Path = "Repository/Products/MyImage.jpg";

Or use two columns in the database as:

Path = "Repository/Products";
FileName = "MyImage.jpg"

I am just wondering how people usually do it.
I might be forget some issue that can favor one of the approaches.

Any advice is welcome.

Thanks,
Miguel
 
D

DaveL

Either On Would be Fine
My self in our system with millions of files
i use Path+Filename
if paths change then i just update finding old path replace with new path
(this happens but not often)

if you have tons of files like we do...
we make a folder structure based on day
for example
CustomerAbc
D:\CustomerFiles\
AbcCustomer\20090601
20090602
in this case many Users send many Files for one Customer...so by doing
Folders it keeps file count low for the os to process
so this would be stored in the Datbase table
\\Server\CustomerFiles\AbcCustomer\20090601\SomeFilename.jpg


DaveL
 
P

Peter Duniho

[...]
For example, on my database should I have a column named Path which
could become:

Path = "Repository/Products/MyImage.jpg";

Or use two columns in the database as:

Path = "Repository/Products";
FileName = "MyImage.jpg"

I am just wondering how people usually do it.
I might be forget some issue that can favor one of the approaches.

IMHO, the main issue is whether you can avoid repeating the path
information. For example, you've got a record in which there are multiple
files, all using the same path. Or you can store the path information in
a separate table that can be related to records in the table where the
file names are used. Or you have some way of making the file name column
optional when the file name is simply based on some other data in the
record.

If for every FileName column you will have a Path column and vice a versa,
then I'd just put everything in the same string and column. The code to
manipulate the path vs. file name gets a tiny bit more complex, but the
Path class makes that fairly easy to manage, and the database itself
should be that much more efficient.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top