Copy images between Amazon s3 buckets in memory only using Chilkat’s S3_DownloadBytes and S3_UploadBytes. Example classic ASP code. 

Function http_copy_bytes(contentType,bucketSourceName,bucketDestName,objectName,justFileName) 
    Dim success, binaryImage 

    ‘ Set up chilkat http 
    Dim http : Set http = Server.CreateObject(“Chilkat.Http”) 
    http_unlock(http) 
    http.AwsAccessKey = AwsAccessKey ‘ your key 
    http.AwsSecretKey = AwsSecretKey ‘ your key 

    ‘ Download image from source bucket 
    binaryImage = http.S3_DownloadBytes(bucketSourceName,objectName) 

    ‘ Upload file to destination bucket 
    success = http.S3_UploadBytes(binaryImage,contentType,bucketDestName,lcase(objectName)) 

    If (success < 1) Then 
        Response.Write Server.HTMLEncode( http.LastErrorText) 
    Else 
        Response.Write Server.HTMLEncode( “File uploaded.”) 
    End If 
    Set http = Nothing 
End Function 

Last modified: May 7, 2019

Author

Comments

Write a Reply or Comment

Your email address will not be published.