ReadBinaryFile

The ReadBinaryFile function reads the "abstract" binary file into the memory as SAFEARRAY.

ReadBinaryFile sFileName,iMaxBytes

Parameters

sFileName
Specifies the name of the file to read.

iMaxBytes
Variable specifying the the maximal file size (in bytes) to be read. If file size exceeds this limit the file doesn't be read at all. On exit this value contains the number of read bytes. This value is set to 0 if any error occures.

Return value

The function returns the binary file as SAFEARRAY. The low bound of the array is always zero. Moreover, the iMaxBytes parameter is changed too.

Remarks

You can send the file read by this function to the client using Response.BinaryWrite method.

Example

<%
Response.Contenttype="image/jpeg"
set obj=CreateObject("shotgraph.image")

maxsize=18432
data=obj.ReadBinaryFile("c:\image.jpg",maxsize)
Response.BinaryWrite data
%>