标题:[原创]文件下载(WEB)
只看楼主
梓风
Rank: 2
等 级:新手上路
威 望:4
帖 子:181
专家分:0
注 册:2006-10-22
 问题点数:0 回复次数:0 
[原创]文件下载(WEB)
Private Sub downloadfile(ByVal fileName As String)
Dim fileStream As New System.IO.FileStream(fileName, FileMode.Open)
Dim fileSize As Long = fileStream.Length
Dim inta As Integer = CInt(fileSize)
Try
Context.Response.ContentType = "application/octet-stream"
Context.Response.AddHeader("Content-Disposition", "attachment; filename=" & HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8))
Context.Response.AddHeader("Content-Length", fileSize.ToString())
Dim fileBuffer(inta) As Byte
fileStream.Read(fileBuffer, 0, inta)
fileStream.Close()
Context.Response.BinaryWrite(fileBuffer)
Context.Response.End()
Catch ex As Exception
Me.ShowAlert1(ex.Message.ToString())
End Try
End Sub
搜索更多相关主题的帖子: WEB 文件 
2006-10-25 17:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-98691-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040656 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved