0

I have an image name defaultImage.jpeg. I can get the image using the following code:

string defaultImageDir = AppDomain.CurrentDomain.BaseDirectory + "\\Images\\defaultImage.jpeg";

Say that I create a dog, a Mastiff for some reason. While the app creates the dog, I would like to get this default image, then save it in a particular folder under the name of the dog. But I've never worked with images else the one we load from the net and this one is already in the project, so how might I do this?

hsim
  • 2,000
  • 6
  • 33
  • 69

1 Answers1

1

You can copy the image from one directory to another.

System.IO.File.Copy(Server.MapPath("/Images/defaultImage.jpeg"), Server.MapPath("/Dog/defaultImage.jpeg"));

While the first parameter is your source file and the second parameter is your destination file.

chamara
  • 12,649
  • 32
  • 134
  • 210