/    Sign up×
Community /Pin to ProfileBookmark

amazon s3 putObject

I am currently working with CI framework.

On my localhost I have created a folder in the CI folder called “uploads” it is basically next to “applications”, “systems” …

Also the S3 library is placed and it works well, I can create buckets, but when I want to upload a file from the uploads folder to a folder within the bucket that file does not get stored, rather a 1kb file with the name I provide gets placed instead.

Below is my code, as hard as I am trying it is just not going through; the location is also correct because using the same path I can easily unlink files.

[code=php]$this->s3->putObject(‘uploads/catimage.jpg’, ‘adp-asset’, ‘storage/23/catimage.jpg’, S3::ACL_PUBLIC_READ, $location = false);
[/code]

It creates the folder 23 and also creates the file catimage.jpg; but the file is just a 1kb file, not the original.

Can anyone help me out and tell me what I am doing incorrectly?

Thanks.

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMay 09.2011 — Do you have a link to any documentation on that S3 object you are using, in particular the putObject() method? Also, have you checked the actual content of the 1KB file it creates, e.g. to see if it is identical to the first 1KB of the copied file or if it contains something different?
Copy linkTweet thisAlerts:
@XeroSiSauthorMay 10.2011 — Basically it is using this library (the one made for CI of course):

http://undesigned.org.za/2007/10/22/amazon-s3-php-class

The documentation is:

http://undesigned.org.za/2007/10/22/amazon-s3-php-class/documentation#putBucket

The file is just an empty file, nothing is stored inside it.
Copy linkTweet thisAlerts:
@NogDogMay 10.2011 — Do you think you need to use the inputFile() method on that first arg?
[code=php]
$this->s3->putObject(S3::inputFile('uploads/catimage.jpg'), 'adp-asset',
'storage/23/catimage.jpg', S3::ACL_PUBLIC_READ, $location = false);
[/code]
Copy linkTweet thisAlerts:
@XeroSiSauthorMay 10.2011 — WOW!! It worked ... thank you so much!
Copy linkTweet thisAlerts:
@NogDogMay 10.2011 — Lucky guess. ?
×

Success!

Help @XeroSiS spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...