I'm trying to create a folder on the directory where the .exe file is and save a picture in that folder.
Right now that folder doesn't exist so I'd like to be created. Here's the code I have:
public void SavePictureToFileSystem(string path, Image picture)
{
string pictureFolderPath = path + "\\" + ConfigurationManager.AppSettings["picturesFolderPath"].ToString();
picture.Save(pictureFolderPath + "1.jpg");
}
The Image isn't being saved to the pictureFolderPath but to the path variable. What do I need to accomplish this?
Thanks for the help! This is what I ended up with:
public void SavePictureToFileSystem(string path, Image picture)
{
var pictureFolderPath = Path.Combine(path, ConfigurationManager.AppSettings["picturesFolderPath"].ToString());
if (!Directory.Exists(pictureFolderPath))
{
Directory.CreateDirectory(pictureFolderPath);
}
picture.Save(Path.Combine(pictureFolderPath, "1.jpg"));
}