//分客户分类别建立上传图片的文件夹
if (!Directory.Exists(HttpContext.Current.Server.MapPath("uploadfile/") + "//" + CurrentLoginUser.LoginName+"//产品图片"))
{
Directory.CreateDirectory(@HttpContext.Current.Server.MapPath("uploadfile/") + "//" + CurrentLoginUser.LoginName+"//产品图片");
}
if (FileUpload1.PostedFile.FileName != "")
{
string ImgPath = FileUpload1.PostedFile.FileName;
string ImgName = ImgPath.Substring(ImgPath.LastIndexOf("//") + 1);
string ImgExtend = ImgPath.Substring(ImgPath.LastIndexOf(".") + 1);
if (!(ImgExtend == "bmp" || ImgExtend == "jpg" || ImgExtend == "gif"))
{
return;
}
string ServerPath = Server.MapPath("uploadfile/"+CurrentLoginUser.LoginName+"/产品图片/") + ImgName;
FileUpload1.PostedFile.SaveAs(ServerPath);
ProModel.photoFile = ImgName;
}
productHelper insertPro = new productHelper();
insertPro.product = ProModel;