HttpFileCollection files=HttpContext.Current.Request.Files;
try
{
for(int i=0;i<files.Count;i++)
{
string fid=(itemid1+1)+".gif";
string strname="id"+layerbh[i].ToString();
HttpPostedFile postedFile=files[i];
if(postedFile.FileName.Length>0)
{
string fileName,fileExtension;
fileName=System.IO.Path.GetFileName(postedFile.FileName);
fileExtension=System.IO.Path.GetExtension(fileName);
if(fileExtension!=GlobalVars.FILETAILNAME[0])
{
Response.Write("<script>alert(/"文件格式不正确!!!/")</script>");
return;
}
if(System.IO.Directory.Exists(Server.MapPath(Request.ApplicationPath) + "//images//img_Visual//show//"+layerbh[i]))
{
postedFile.SaveAs(Server.MapPath(Request.ApplicationPath) + "//images//img_Visual//show//"+layerbh[i]+"//" + fid);
}
else
{
System.IO.Directory.CreateDirectory(Server.MapPath(Request.ApplicationPath) + "//images//img_Visual//show//"+layerbh[i]);
postedFile.SaveAs(Server.MapPath(Request.ApplicationPath) + "//images//img_Visual//show//"+layerbh[i]+"//" + fid);
}
}
else
{
Response.Write("<script>alert(/"虚拟形象图片不能为空!/")</script>");
return ;
}
}
}
catch(System.Exception Ex)
{
this.Label1.Text= Ex.Message;
}