Jump to content

Upload to Amazon S3 using Web Assistant


This topic is 3415 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Has anyone used Web Assistant to upload files to Amazon S3?  I'm not familiar with using POST and the resources I've found are a little beyond me.  Any advice would be appreciated.

 

Or is there an alternative to Web Assistant that works?

 

Thanks!

 

 

Resources I've found

http://aws.amazon.com/articles/1434
http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html
http://docs.aws.amazon.com/AmazonS3/latest/dev/HTTPPOSTExamples.html

http://static.360works.com/plugins/WEBASSISTANTPLUG/documentation.html

Link to comment
Share on other sites

  • 5 weeks later...
  • 1 month later...

I have created a scriptmaster function to upload to s3 and return a signed url using amazons jets3t.jar that is working for me.

RegisterGroovy( "UploadToS3( keyAccess ; keySecret ; bucket ; filePath ; daystoexpire )" ; "import org.jets3t.service.impl.rest.httpclient.RestS3Service¶
import org.jets3t.service.model.S3Bucket¶
import org.jets3t.service.model.S3Object¶
import org.jets3t.service.security.AWSCredentials¶

¶
accessKey = keyAccess¶
secretKey = keySecret¶
bucketName = bucket¶
uploadFile = filePath¶
int expiryDays = Integer.parseInt(daystoexpire)¶
¶
credentials = new AWSCredentials(accessKey, secretKey)¶
service = new RestS3Service(credentials)¶
bucket = new S3Bucket(bucketName)¶
file = new File(uploadFile)¶
fileObject = new S3Object(file)¶
fileObject.key = fileObject.getKey()¶
service.putObject(bucket, fileObject)¶
expiryTime = new Date() + expiryDays¶
link = service.createSignedGetUrl(bucket.name, fileObject.key, expiryTime)¶
return link" )

Hope its useful.

Link to comment
Share on other sites

  • 6 months later...

Danny, I'm trying the code you pasted in above but am receiving the following error.

 

java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpHead

 

Just wondering what jar's you had loaded. I have the following loaded

 

/Users/Shared/jets3t.jar

/Users/Shared/commons-logging-1.2.jar
 
I'm using ScriptMaster version 4.32
Link to comment
Share on other sites

This topic is 3415 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.