I would like to understand how to retrieve an Image stored in a mySQL database as a longblob. Once retrieved, assign that image asp.net image control.
Heres the code that uploads the pic to the MYSQL database
If (Not myups.HasFile) Then
Return -1
End If
'FileName.PostedFile.InputStream()
Try
Dim fs As FileStream = Nothing
'Dim img As FileUpload = CType(imgUpload, FileUpload)
Dim imgByte As Byte() = Nothing
'If img.HasFile AndAlso Not img.PostedFile Is Nothing Then
'To create a PostedFile
Dim File As HttpPostedFile = myups.PostedFile
'Create byte Array with file len
imgByte = New Byte(File.ContentLength - 1) {}
'force the control to load data in array
File.InputStream.Read(imgByte, 0, File.ContentLength)
When I pull the raw data from the database how do I convert that raw data back to an value that can be assigned to an aspt.net image.
Private Function CreateImage(ByRef pPanel As Panel, ByVal RawData As Byte) As Panel
Dim myimage As New Image
myimage.ImageUrl = ?
pPanel.Controls.Add(myimage)
Return pPanel
End Function