This shows you how To upload a file In binary format to a database
CODE:
''''''''''btnupload click is the fileupload button
'''''VB.NET
Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click
If FileInput.PostedFile Is Nothing Then
lblError.Text = "No file specified."
Else
If FileInput.PostedFile.ContentLength > 2097152 Then ' 2097152 Bytes = 2 MB
lblError.Text = "File size cannot exceed 2 MB."
Return
End If
Dim byteFile As Byte()
''''' look fro code here for this function
byteFile = GetByteFromPostedFile(FileInput.PostedFile)
''''store to database
Storetodatabase(filename,byteFile)
End Sub
0 comments:
Post a Comment