am creating new folder for each user who uploads any files. all the uploaded files will be in that folder.
here is sample
//file upload
if ((FileUpload1.PostedFile != null) && (FileUpload1.PostedFile.ContentLength > 0))
{
System.IO.Directory.CreateDirectory(Server.MapPath("Upload" + "/" + Request.Cookies["uname"].Value.ToString()));
string a;
string fn = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
SaveLocation = "Upload" + "/" + Request.Cookies["uname"].Value.ToString() + "/" + fn;
a = Server.MapPath("Upload" + "/" + Request.Cookies["uname"].Value.ToString()) + "/" + fn;
try
{
FileUpload1.PostedFile.SaveAs(a);
}
catch (Exception ex)
{
Response.Write("Error: " + ex.Message);
}
}
here above code is used to create a new folder with his name.