1.创建一个aspx的页面。
2.创建
3.创建
4.上传代码中调用net2.dll的动态库处理过程。
5.如果创建多个上传文件,可以多写几个
6.最后单击上传按钮,执行其中处理过程。
具体过程如下
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()取得文件名 string oldfilename = file.GetName().ToString();
//如果对上传后的文件进行重新命名,根据guid进行命名,则放开下面二行代码 //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; }