下载功能和上传功能的实现

下载功能
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=**.doc");
string filename = Server.MapPath("~/manage/upload/**.doc");
Response.TransmitFile(filename);
上传功能的实现
if (this.File1.PostedFile != null)
            {
                string finame = File1.PostedFile.FileName;
                int i = finame.LastIndexOf(".");
                string newname = finame.Substring(i);
                string str = Server.MapPath("~/manage/upload/");
                File1.PostedFile.SaveAs(str+"**"+newname);
            }
posted @ 2012-08-07 11:05  隔壁王叔  阅读(674)  评论(9编辑  收藏  举报