日期:2014-05-18  浏览次数:20729 次

谁有附件下栽的代码,提供一下,谢谢拉!
谁有附件下栽的代码,提供一下,谢谢拉!

------解决方案--------------------
C# code
    void DownFile(string path, string filename, string oldname)
    {
        BDB.ActionLogInsert(UID, "下载附件:" + oldname);

        Response.Clear();
        Response.Buffer = true;
        EnableViewState = false;
        Response.ContentEncoding = System.Text.Encoding.Default;
        Response.ContentType = "application/octet-stream";
        Response.HeaderEncoding = System.Text.Encoding.GetEncoding("gbk");   //gbk支持gb2312和big5
        Response.AppendHeader("Content-Disposition", "attachment;filename=" + oldname);
        Response.WriteFile(path + filename);
        Response.Flush();
        Response.Close();
        Response.End();
    }