上传文件:string[] point=fileup.PostedFile.FileName.Split(".".ToCharArray());
string filename=proot+"."+point[point.Length-1];
string path=Server.MapPath("../../news/pic/")+filename;
if(File.Exists(path)==true)
{
Response.Write("<script>alert('该文件已经存在!')</script>");
}
else
{
if(fileup.PostedFile.FileName!="")
{
fileup.PostedFile.SaveAs(path);
}
StreamReader SR=new StreamReader(Server.MapPath("../../")+"detail.html",Encoding.Default);
string detailHtml=SR.ReadToEnd();
SR.Close();
下载文件:
string downfilename = "tblAd.cs";//要下载的文件(可以是绝对路径) 
        string path = Server.MapPath("DataTable/")+downfilename ;
        //初始化 FileInfo 类的实例,它作为文件路径的包装 
        FileInfo fi = new FileInfo(path);        //判断文件是否存在 
        if (fi.Exists)
        {
            //将文件保存到本机上 
            Response.Clear();
            Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(fi.Name));
            Response.AddHeader("Content-Length", fi.Length.ToString());
            Response.ContentType = "application/octet-stream";
            Response.Filter.Close();
            Response.WriteFile(fi.FullName);
            Response.Flush();
         }