string fullFileName = this.FileUp.PostedFile.FileName; //获取上传文件的全名
string type = fullFileName.Substring(fullFileName.LastIndexOf(".") + 1); //获取上传文件的类型
//判断文件的类型
if ((type == "jpg" || type == "jpeg" || type == "gif" || type == "png" || type == "swf" || type == "rar" || type == "zip") && FileUp.PostedFile.ContentLength < 2 * 1024 * 1024)
{
this.FileUp.PostedFile.SaveAs(Server.MapPath("../UpFiles/") + "\\" + fileName);
this.UploadPan.Visible = false;
this.UploadedPan.Visible = true;
this.CopyTxt.Value = "../UpFiles/" + fileName;
}
else
{
this.message.Text = "文件格式不正确/或者文件过大!";
}