Using the Leigh S3Wrapper.cfc Version Cannot Pass Init

I am new to S3 and I need to use it to store images. I found half a dozen s2wrapper versions for cf, but it seems that only one set for v4 is one modified by Leigh

https://gist.github.com/Leigh-/26993ed79c956c9309a9dfe40f1fce29

Dropped from the com directory and created a "test" page containing the following code:

s3 = createObject('component','com.S3Wrapper').init(application.s3.AccessKeyId,application.s3.SecretAccessKey);

but got the following error: enter image description here

So, I changed line 37 of

variables.Sv4Util = createObject('component', 'Sv4').init(arguments.S3AccessKey, arguments.S3SecretAccessKey);

to

variables.Sv4Util = createObject('component', 'Sv4Util').init(arguments.S3AccessKey, arguments.S3SecretAccessKey);

Now I get: enter image description here

I like to go through Lee’s code and start changing things, this is a bad idea, since I’ve been hiding here for a year, I know that Leah’s code is strong.

Does anyone know if there are any examples of how to use this? If not what I'm doing wrong. If that matters, I'm using Lucee 5, not the Adobe CF engine.

UPDATE:

, . , :

<cfscript>
    s3 = createObject('component','com.S3v4').init(application.s3.AccessKeyId,application.s3.SecretAccessKey);

    bucket = "imgbkt.domain.com";
    obj = "fake.ping";
    region = "s3-us-west-1"

    test = s3.getObject(bucket,obj,region);
    writeDump(test);
    test2 = s3.getObjectLink(bucket,obj,region);
    writeDump(test2);

    writeDump(s3);
</cfscript>

, bucket, obj region, : enter image description here

JIC AWS : enter image description here

, -, s3Wrappers ?

# 2: . , getObjectLink, , getObject . , putObject

test3 = s3.putObject(bucketName=bucket,regionName=region,keyName="favicon.ico");
writeDump(test3);

, - , : enter image description here

https://shlomoswidler.com/2009/08/amazon-s3-gotcha-using-virtual-host.html, , S3 bucketnames, , . , , , , , .

+6
1

, :

getObjectLink URL- HTTP fake.ping, imgbkt.domain.com s3-us-west-1. 60 .

getObject getObjectLink URL- HTTP GET. S3v4.cfc fake.ping . , : E:\wwwDevRoot\taa\fake.ping

, :

downloadPath = 'E:\';
test = s3.getObject(bucket,obj,region,downloadPath);
writeDump(test);

HTTP- , , .

, :

test = s3.getObject(bucket,obj,region);

contentAsString = fileRead(test); // returns the file content as string
// or
contentAsBinary = fileReadBinary(test); // returns the content as binary (byte array)

writeDump(contentAsString);
writeDump(contentAsBinary);

(, , , fileRead/fileReadBinary . fileOpen .

?

0

All Articles