I have used AjaxFileUpload to upload multiple image files. Now i want to store the uploaded images inside rootfolder>subfolder.
The rootfolder is in the name of the user. The rootfolder is created dynamically by taking the session of the user who has logged in Like this:
string username = Session["username"].ToString();
I am able to create this folder and save images in it. but i want to save it in subfolder.
the subfolder is also created dynamically but this time i have to take the value(id) from the database and name the folder by that id name. (this is so that i can refer to the database)
I know how to create a new folder using Server.MapPath(); Here is the code for it in brief
using System.IO
if (Directory.Exists(Server.MapPath(uploadPath))) return;
else Directory.CreateDirectory(Server.MapPath(uploadPath));
where uploadPath is the folder's name i want to create dynamiclly.
but how do I include the subfolder too in my Server.MapPath() so as to make my path as rootfolder/subfolder ?
Small example to make the question understandable. I am a seller. I have posted 4 ads online. Now when i am posting my 5th ad i want to include many images. these images should be saved in the folder
Seller/5/imagename.jpg. (where Seller is the username(main folder), 5 is the advertID in the database and the name of the subfolder)
How do i do this? Please help. I am using asp.net c#