Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have an asp.net FileUpload control.

Now i want to upload multiple attachments and save uploaded file paths in sql database.

here how to save multiple file paths in sql server column if user uploads multiple attachments using file upload control?

i want the code how to save multiple file paths in sql server file path column?
Posted
Comments
Herman<T>.Instance 14-Nov-12 10:23am    
you question yourself about what you want?

1 solution

Well, you have two options. One : choose a character that is not valid for a file path, like ?, and use that as a delimiter to store a list that needs to be split. Second, create a mapping table so you can map multiple file paths to one entry by it's id. So your main table has an id column and your new table contains that id, and a file path, with one entry per path.
 
Share this answer
 
Comments
deepisingh 14-Nov-12 10:50am    
i want code how to use delimiter and store to list and split
Christian Graus 14-Nov-12 10:54am    
This is beyond trivial. The string class has a split method, and you should use StringBuilder, not just +, to build the string. This is the least good option, overall.
deepisingh 14-Nov-12 10:58am    
anyone pls help me out by giving sample code
Christian Graus 14-Nov-12 11:03am    
string [] paths = thepath.Split('?');

I do recommend if you ever want to be a programmer, being willing to do basic research on your own and to know some basic concepts.
deepisingh 14-Nov-12 11:04am    
if user delete the file attachment then tht file path must be remove from list and save in database

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