Sample code for 30+ languages & platforms
Classic ASP

Load Entire File into BinData

Demonstrates how to load an entire file into a BinData object.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

set fac = Server.CreateObject("Chilkat.FileAccess")

success = fac.OpenForRead("qa_data/pdf/sample.pdf")
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( fac.LastErrorText) & "</pre>"
    Response.End
End If

set bd = Server.CreateObject("Chilkat.BinData")
maxBytesToRead = 99999999
success = fac.FileReadBd(maxBytesToRead,bd)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( fac.LastErrorText) & "</pre>"
    Response.End
End If

fac.FileClose 

' The bd object contains the file data...
success = bd.WriteFile("qa_output/sample.pdf")

%>
</body>
</html>