Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have multiple clients and i want to upload multiple files in one clientId, So that that particular client can download the uploaded file!
how do i save multiple path in the database for one particular client???
Posted

1 solution

Set up a table to hold the file paths - it needs three columns:
ID - primary key. Into is probably fine, as is Identity
CustomerId - type matches that in customer table and is a foreign key
Path - nvarchar


I would probably add an OriginalFileName and a VersionNumber field, and store the file under a Guid name rather than the original name (so it's easier for different customers to have different files with the same name.

You then retrieve the files by searching for the customer is.
 
Share this answer
 
Comments
Gourango 18-Jul-13 2:39am    
Itz like i have 2 fields..
1- ClientId
2- PathOfFile

when i upload a file in a particular clients id, itz path is stored in the PathOfFile column.
but when i upload an another file in the same id, the previous path is replaced with the new one. I dun want this path to be replaced, I want this new path to b stored as well, keeping the old one intact!
OriginalGriff 18-Jul-13 4:04am    
Yes, exactly.
All you do is INSERT a new row into the table (that's why you have a separate table to the client table, and refer back to the client via the ID).
So you have your Client table:
ClientID
ClientName
...
And a separate Files table:
FileID
FileName
ClientID
...
you then can add as many rows to the files table as you need for a particular Client.
As I said, I store the original filename in the files table, and store the actual file under a Guid, so that two files of the same name from different clients, (or two versions from the same client) don't overwrite each other.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900