Closed i-shanghai closed 5 years ago
已经看到SDK下载的文件,只指定保存到 某个路径+随机文件名 自定义文件名需要,再对已经保存的文件重命名:
///
//文件重命名
var newFileName = fileSaved + ".png";
System.IO.File.Move(fileSaved, newFileName);
return Content("图片下载成功:" + newFileName);
}
对的,目前是这样的,因为下载的某些文件名可能会包含非法的字符串。
问题描述
CO2NET.HttpUtility.Get.Download(url, filePath) 无法保存filePath中自定义的文件名字 CO2NET 依旧保存的是随机字符串
问题重现
Sample(.NET45)项目中,加入以下方法,传递文件名字参数 最终保存到了dir路径 下面,但是没有保存文件名字:DownloadImage_TEST.jpg 而是保存了:SenparcWechatCourse\Images\20190112-164423fcac24
public ActionResult GetImage(string url = "http://sdk.weixin.senparc.com/images/book-cover-front-small-3d-transparent.png") { var filePath = Server.MapPath("~/Images/") + "DownloadImage_{0}.jpg".FormatWith("TEST");
发现问题的模块
模块对应的 .net 版本
开发环境