//上传:

用个FileUpload1控键

string sFileName;

sFileName 
= FileUpload1.FileName;

string sFilePath = Server.MapPath("File");

string strPath = System.IO.Path.Combine(sFilePath, FileUpload1.FileName);

FileUpload1.PostedFile.SaveAs(strPath);

//下载:

string filepath = Server.MapPath("File");

string filename = //下载文件名;

string path = filepath + filename;

Response.Clear();

Response.ContentType 
= "application/octet-stream";

Response.AddHeader(
"Content-Disposition""attachment;FileName=" + HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8));

Response.WriteFile(path);

Response.End();
posted on 2006-06-23 15:53  过江  阅读(293)  评论(0编辑  收藏  举报