Reputation: 9043
This is a silly question perhaps but would like to know how to retrieve the name of an image.
for example
string name;
Image imageOne = Image.FromFile("../../Images/PozeOne.jpg");
name = ?
Upvotes: 0
Views: 59
Reputation: 269
"PozeOne.jpg" is the name of image.... :-)
string path="../../Images/PozeOne.jpg";
string[] imageName=path.split('/');
string image_Name_Is= imageName[imageName.Lenght-1];
Upvotes: 1
Reputation: 17680
You can use Path.GetFilename
var path = "../../Images/PozeOne.jpg";
Image imageOne = Image.FromFile(path);
string name = Path.GetFilename(path);
Upvotes: 4