|
-
Feb 17th, 2003, 11:11 AM
#1
Thread Starter
Frenzied Member
file stream
Is it possible to use this code to view a BLOB in the db. The file not in my harddrive and I'm having a problem converting a Byte()array to a string?
Code:
Dim strFileName As String = ("C:\index.pdf")
Dim objStream As Stream = File.Open(strFileName, FileMode.Open)
Dim buffer(objStream.Length) As Byte
objStream.Read(buffer, 0, objStream.Length)
objStream.Close()
-
Feb 17th, 2003, 02:06 PM
#2
Member
This function will return a string when given a byte array:
Public Function ByteArrayToString(ByVal bytArray() As Byte) As String
Dim UTF8 As New UTF8Encoding()
Return UTF8.GetString(bytArray)
End Function
-
Feb 17th, 2003, 02:25 PM
#3
Thread Starter
Frenzied Member
thanks IOU...I didn't end up needing to convert the Byte array...I used:
Code:
Do While objDR.Read = True
Dim pdf As String = "bid_package.pdf"
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment;filename=" & Trim(pdf))
Response.BinaryWrite(objDR("bid_document"))
Response.Flush()
Response.End()
Loop
but I'm going to save that piece of code..thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|