Classic ASP
Classic ASP
Demonstrate S3_DownloadBytes
Demonstrates how to download a file into memory from the Amazon S3 service.Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' This example assumes the Chilkat HTTP API to have been previously unlocked.
' See Global Unlock Sample for sample code.
set http = Server.CreateObject("Chilkat.Http")
http.AwsAccessKey = "AWS_ACCESS_KEY"
http.AwsSecretKey = "AWS_SECRET_KEY"
bucketName = "chilkat.qa"
objectName = "images/sea_creatures/starfish.jpg"
localFilePath = "qa_output/starfish.jpg"
jpgBytes = http.S3_DownloadBytes(bucketName,objectName)
If (http.LastMethodSuccess <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( http.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Download successful.") & "</pre>"
set fac = Server.CreateObject("Chilkat.FileAccess")
success = fac.WriteEntireFile(localFilePath,jpgBytes)
Response.Write "<pre>" & Server.HTMLEncode( "File saved success = " & success) & "</pre>"
%>
</body>
</html>