理解为:case "upLoadFile":
{
string companyID = context.Request.Form["companyID"].ToString();
string savepath = context.Server.MapPath("~/Customer_files/customerCompanyUpLoad/"+companyID);
Directory.CreateDirectory(savepath);//创建此目录
HttpPostedFile postedFile = context.Request.Files["photo-path"]; //获取上传信息对象
string filename = System.IO.Path.GetFileName(postedFile.FileName); //获取上传的文件路径
if (validFileNameExit(filename, savepath)) //判断此文件是否存在
{
string jsonstrs = "{success:false}";
context.Response.Write(jsonstrs);
}
else
{
postedFile.SaveAs(savepath + @"\" + filename); //保存上传文件
//保存
string jsonstrs = "{success:true}";
//返回文件的名称和路径
context.Response.Write(jsonstrs);
}
break;
}
System.IO.File.Delete(dir);