如何在单个文件夹中存储名称文件?
问题描述:
我想将名称中的文件存储在单个文件夹中而不替换旧文件....如何操作。感谢先生...........
I want to store file with name in single folder without replacing old file....How to do it.??Thanks in advnce...........
答
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;
}