I know how to save an image to a folder using the fileupload control with the saveas method. But I to take an image from the image control and save it to a file without using the fileupload control n save it in folder.
            Asked
            
        
        
            Active
            
        
            Viewed 1.2k times
        
    3 Answers
2
            string filepath = img1.ImageUrl;           
using (WebClient client = new WebClient())
{
       client.DownloadFile(filepath,Server.MapPath("~/Image/apple.jpg"));
}
 
    
    
        Kiran Solkar
        
- 1,204
- 4
- 16
- 29
1
            
            
        Do you know image path? you can get image path from image control and then download image in code:
Download image from the site in .NET/C#
using(WebClient client = new WebClient()) 
{
    client.DownloadFile("http://www.example.com/image.jpg", localFilename); 
} 
1
            
            
        First Get the Url of Image and then using webclient you can save file in folder
string filepath = img1.ImageUrl;           
using (WebClient client = new WebClient())
{
       client.DownloadFile(filepath,Server.MapPath("~/Image/apple.jpg"));
}
This will save image in Image Folder with ImageName apple...
 
    
    
        Kartik Patel
        
- 9,303
- 12
- 33
- 53
 
    