从本地系统下载文件 [英] download file from local system
本文介绍了从本地系统下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此代码用于从本地系统下载文件
this code is use to download the file from local system
protected void LinkButtonDownload_Click(object sender, EventArgs e)
{
Response.ContentType = "Application/msword";
Response.AppendHeader("Content-Disposition", "attachment; filename=Test.docx");
Response.TransmitFile(Server.MapPath("~/Files/Test.docx"));
Response.End();
}
但是我需要代码从sql数据库下载文件......
请帮助我........
but i need the code to download the file from sql database.........
pls hlp me........
推荐答案
好吧,看来您正在下载到本地文件系统.如果文件在数据库中,则需要将其拉出并使用Response.BinaryWrite而不是Response.TransmitFile来将其写入流中.
Well, it looks like you''re downloading TO the local file system. If your file is inside a DB, you need to pull it out and use Response.BinaryWrite instead of Response.TransmitFile to write it to the stream.
这篇关于从本地系统下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文