Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to store file with name in single folder without replacing old file....How to do it.??Thanks in advnce...........
Posted
Updated 8-Mar-15 22:00pm
v3

1 solution

private string getimage(string url)
{
string remoteImgPath = url;
Uri remoteImgPathUri = new Uri(remoteImgPath);
string remoteImgPathWithoutQuery = remoteImgPathUri.GetLeftPart(UriPartial.Path);

string file = Path.GetFileName(remoteImgPathWithoutQuery);
string fileName = file.Save(file, "profile_img_" + Userid);
 
string localPath = AppDomain.CurrentDomain.BaseDirectory + "content\\uploads\\profile\\" + fileName+".jpg";
WebClient webClient = new WebClient();
webClient.DownloadFile(remoteImgPath, localPath);
return localPath;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900