using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using Telerik.WebControls;public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } /// <summary> /// 保存文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { foreach (UploadedFile file in RadUploadContext.Current.UploadedFiles) { string Path = Server.MapPath(@"Uploads"); //如果路径不存在,则创建 if (System.IO.Directory.Exists(Path) == false) { System.IO.Directory.CreateDirectory(Path); } //组合路径,file.GetName()取得文件名 Path = Path "/" file.GetName().ToString(); //保存 file.SaveAs(Path, true); } }}
评论