I am using c# MVC . I have to save an Image from website to another server to reduce the load of my website . First of all i just want to know is it possible to do so. I am trying to acheive this but there is an exception like Url format is wrong. Here is my code
public static string UploadFile(string images, string folder)
{
try
{
string filePath = string.Empty;
if (!String.IsNullOrEmpty(images))
{
string sourceFileName = System.IO.Path.GetFileName(images);
string destinationFileName = Path.Combine(folder + "/", sourceFileName);
string path = "http://imwedding.ansitdev.com/" + destinationFileName;//System.Web.HttpContext.Current.Server.MapPath(destinationFileName);
System.IO.File.Move(System.Web.HttpContext.Current.Server.MapPath(images), path);
}
return filePath;
}
catch (Exception ex)
{
throw;
}
}