foreach (UploadedFile file in RadUploadContext.Current.UploadedFiles)
{
string Path = Server.MapPath(@"~/Uploads");
//如果路徑不存在,則創(chuàng)建
if (System.IO.Directory.Exists(Path) == false)
{
System.IO.Directory.CreateDirectory(Path);
}
//組合路徑,file.GetName()取得文件名
string oldfilename = file.GetName().ToString();
//如果對上傳后的文件進(jìn)行重新命名,根據(jù)guid進(jìn)行命名,則放開下面二行代碼
//string fileType = oldfilename.Substring(oldfilename.LastIndexOf("."));
//string newfilename = Guid.NewGuid().ToString("N") + fileType;
//Path = Path + "/" + file.GetName().ToString();
Path = Path + "/" + oldfilename;
//保存
file.SaveAs(Path, true);
string newurl = @"~/Uploads/" + oldfilename;
}