(Classic ASP) Load Entire File into BinData
Demonstrates how to load an entire file into a BinData object.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.FileAccess")
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
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.BinData")
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>
|