protected void Button1_Click(object sender, EventArgs e) { if (UploadFile.HasFile) { string FileName = this.UploadFile.FileName; //获取上传文件的文件名,包括后缀 string ExtenName = System.IO.Path.GetExtension(FileName); //获取扩展名 string filenewname = DateTime.Now.ToString("yyyyMMddHHmmssfff"); string SaveFileName = System.IO.Path.Combine(System.Web.HttpContext.Current.Request.MapPath("../upload/workflow/"), filenewname + ExtenName); //合并两个路径为上传到服务器上的全路径 UploadFile.MoveTo(SaveFileName, Brettle.Web.NeatUpload.MoveToOptions.Overwrite); string url = "upload/workflow/" + filenewname + ExtenName; //文件保存的路径 this.uploadurl.Value = url; //float FileSize = (float)System.Math.Round((float)UploadFile.ContentLength / 1024000, 1); //获取文件大小并保留小数点后一位,单位是M this.uploadfiles.Style["display"] = "none"; this.uploadfileok.Style["display"] = ""; } }