我必须下载一个上传的文件,我有以下代码,它有一些错误......任何人都可以提出正确的建议。 [英] I have to download an uploaded file and i have the following code,it has some errors...can anyone give a proper suggestion .

查看:80
本文介绍了我必须下载一个上传的文件,我有以下代码,它有一些错误......任何人都可以提出正确的建议。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码。

  protected   void  gdvfile_RowCommand( object  sender,GridViewCommandEventArgs e)
{
< span class =code-keyword> if (e.CommandName == Download
{
var a = e.CommandArgument.ToString();
string filename = a;
Response.AppendHeader( Content-Disposition attachment; filename = + filename);
string aaa = Server.MapPath( 〜/ Upload / + filename);
Response.TransmitFile(Server.MapPath( 〜/ Upload / + filename)) ;
Response.End();
}
}

解决方案

这可以帮到你



http://stackoverflow.com/questions/6985587/storing-uploading-and-downloading-files-in-asp-net-and-sql-server-database [ ^ ]

This is my code.

protected void gdvfile_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Download")
            {
                var a = e.CommandArgument.ToString();
                string filename = a;
                Response.AppendHeader("Content-Disposition","attachment;filename=" + filename);
                string aaa = Server.MapPath("~/Upload/" + filename);
                Response.TransmitFile(Server.MapPath("~/Upload/" + filename));
                Response.End();
            }
        }

解决方案

This may help you

http://stackoverflow.com/questions/6985587/storing-uploading-and-downloading-files-in-asp-net-and-sql-server-database[^]


这篇关于我必须下载一个上传的文件,我有以下代码,它有一些错误......任何人都可以提出正确的建议。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆