I want to save images at folder like "osc/Screenshots/EmpName/EmpId/scr.jpg"
how to create folder and save image on this path
help me
thanks in advance
I want to save images at folder like "osc/Screenshots/EmpName/EmpId/scr.jpg"
how to create folder and save image on this path
help me
thanks in advance
To get the string representing the path:
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
Probably you want to do something like the following:
DirectoryInfo directory = new DirectoryInfo(path);
To create a new path based on root folder:
var imagePath = path + @"\MyAppName\Images"
if (!Directory.Exists(imagePath))
{
DirectoryInfo di = Directory.CreateDirectory(imagePath);
}
EDIT: As alternative you may use specials folders. For example LocalApplicationData, in this folder you can place machine scoped data of your application per user. Below the variable localData will be
C:\Users\USER_NAME\AppData\Local
where USER_NAME is the user profile.
string localData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
var imagePath = localData + @"\Images";
if (!Directory.Exists(imagePath))
{
DirectoryInfo di = Directory.CreateDirectory(imagePath);
}
AppDomain.CurrentDomain.BaseDirectory
will give you the path to your application folder.