ASP Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

ASP Examples

ASP String
ASP Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar
ASP Upload
XML
XMP
Zip Compression

More Examples...
Email Object
DKIM / DomainKey
NTLM
DH Key Exchange
DSA
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

XML Embed Binary File

Demonstrates how to embed a binary file in XML. Also extracts binary data from XML and saves to a file.

Download Chilkat FileAccess ActiveX (freeware)

Download Chilkat XML ActiveX

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


'  Load a binary file from disk:
set fac = Server.CreateObject("Chilkat.FileAccess")
fileData = fac.ReadEntireFile(Server.MapPath("dude.gif"))

set xml = Server.CreateObject("Chilkat.Xml")

xml.Tag = "gifData"

'  If set to 1, the binary data is automatically compressed
'  before being added to the XML.  In this example, GIF data
'  is already a compressed file format, so we another layer
'  of compression doesn't really help much...
zipFlag = 0

'  The data may be automatically 128-bit AES encrypted
'  if this flag is set to 1.
encryptFlag = 0

password = "NotUsed"

success = xml.SetBinaryContent(fileData,zipFlag,encryptFlag,password)

'  Examine the XML.  (The binary content is base64-encoded)
Response.Write "<pre>" & Server.HTMLEncode( xml.GetXml()) & "</pre>"

'  Now extract the content to a file:
success = xml.SaveBinaryContent("out.gif",zipFlag,encryptFlag,password)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode(xml.LastErrorText) & "</pre>"
End If

'  The original data may be saved using the FileAccess component in this way:
success = fac.WriteEntireFile(Server.MapPath("original.gif"), fileData)
If (success = 0) Then
    Response.Write fac.LastErrorHtml
End If

%>
</body>
</html>

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.