FileUpload控件是将附件下载到服务器端的磁盘上吗?如何通过访问服务器端的磁盘,打开和下载附件?我是新手,想问一下一般上传的附件是存在哪里,有从哪里下载?整个流程是怎么样的?请大家帮忙,谢谢!
解决方案 »
- 问个问题!!
- Repeater实现GridView编辑修改模式
- 非常奇怪的问题,谁能解决?传值读取错误
- GridView和DetailsView配合使用遇到的问题
- 怎么替换<img>标签的>
- 发现一个通达OA视频会议组件源码,代码没有加密,完全公开
- 请大家讨论对话框刷新问题?
- 急!!!怎样控制同一账号同密码不能同时在线的问题?
- .NET Framework中的QuickStart的访问问题-为什么不能用http;//(机器名)/quickstart访问?
- 初学,出现这样的错误,原因何在
- 求教!为什么在MVC用模板页嵌套的网页 弹出层时页面 ,页面会滚动到最上部??
- 在vs2010里面 超链接地址错误,这个是怎么回事啊?
直接打开和浏览器有关。
以 下代码为从数据库中导出数据的程序,可参考:
If Not oRpt Is Nothing Then
Dim exptype As ExportFormatType
Dim cttype As String
Dim stm As Stream
Dim fname As String = "fname"
Dim fext As String
Select Case ddlfiletype.SelectedIndex
' case 0:
' exptype=ExportFormatType.Excel;
' cttype="application/msexcel";
' fext=".xls";
' break;
' Case 0
exptype = ExportFormatType.PortableDocFormat
cttype = "application/octet-stream"
fext = ".pdf"
Exit Select
Case 1
exptype = ExportFormatType.WordForWindows
cttype = "application/msword"
fext = ".doc"
Exit Select
Case 2
exptype = ExportFormatType.Excel
cttype = "application/msexcel"
fext = ".xls"
Exit Select
Case Else
exptype = ExportFormatType.RichText
cttype = "text/plain"
fext = ".rtf"
Exit Select
End Select
fname = fname & fext stm = oRpt.ExportToStream(exptype)
' If Not (InlineAssignHelper(stm, oRpt.ExportToStream(exptype))) Is Nothing Then
If Not stm Is System.DBNull.Value Then '!!!###
Dim FileSize As Long FileSize = stm.Length Dim Buffer As Byte() = New Byte(CInt(FileSize) - 1) {}
stm.Read(Buffer, 0, CInt(FileSize))
stm.Close()
''常见文件的MIME类型
''GIF文件 "image/gif"
''BMP文件 "image/bmp"
''JPG文件 "image/jpeg"
''zip文件 "application/x-zip-compressed"
''DOC文件 "application/msword"
''文本文件 "text/plain"
''HTML文件 "text/html"
''一般文件 "application/octet-stream"
'
'
' '读取数据库中保存的内容
Response.Clear()
Response.Expires = 0
Response.Buffer = True
Response.ContentType = cttype
Response.AddHeader("Content-Length", FileSize.ToString())
Response.AddHeader("Content-Disposition", "attachment;filename=" & fname)
Response.BinaryWrite(Buffer)
Response.Flush()
Response.Close()
Else
lblstatus.Text = "导出失败!"
End If
Else
lblstatus.Text = "没有符合条件的数据!"
End If
如http://www.codeproject.com/KB/office/WordInDotnet.aspx
http://www.itwriting.com/htmleditor/index.php