1.控制器中使用的方法
- 正则表达式验证:Regex.IsMatch(要验证的数据,正则表达式)
- 返回一个文件:
return File(要返回的文件,"返回的文件类型",返回的文件名称)
3.检查文件是否存在目录中
//Directory.Exists(物理路径)
//Server.MapPath("虚拟路径")==> 将虚拟路径转化为物理路径
if(!System.IO.Directory.Exists(Server.MapPath("~/document/studentpicture/"))){
System.IO.Directory.CreateDirectory(Server.MapPath("~/document/studentpicture/"));
}