Search Tools Links Login

Download a BLOB directly from Database without temporary files or chunks

Download a binary large object (BLOB) from the database without temporary files or chunks.

Original Author: Thommy


Dim objStream 'As ADODB.Stream
Dim objBLOB  'As Object
Dim strBLOB  'As String
Dim lngBLOB  'As Long
'Create objects
Set objStream = Server.CreateObject("ADODB.Stream")
'Get the object, the object size and the object name from the database
'Set objBLOB = ... 'Get the BLOB out of the database
'strBLOB = ...   'Filename to be saved to
'lngBLOB = ...   'Length of the BLOB
'Assign object to stream
With objStream
.Type = 1
.Write objBLOB
End With
'Start forcing download
With Response
.AddHeader "Content-Disposition", "attachment; filename=" & strBLOB
.AddHeader "Content-Length", lngBLOB
.ContentType = "binary/octet-stream"
.BinaryWrite objStream.Read
End With
'Close all objects
'Clean up
Set objStream = Nothing
Set objBLOB = Nothing

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 102 times




No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.