Welcome Guest, Not a member yet? Register   Sign In
amazon s3 putObject
#1

[eluser]xerosis[/eluser]
On my localhost I have created a folder in the CI folder called "temp" 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 temp 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, I think I am not giving it a proper location of where temp folder is, but I am not sure how I can make it right, can someone tell me what I am doing wrong here.

Code:
$this->s3->putObject('./temp/122222.jpg', 'adp-asset', 'storage/23/122222.jpg', S3::ACL_PUBLIC_READ, $location = false);

Thanks.
#2

[eluser]InsiteFX[/eluser]
You may need to give it the full url path. also check to see if you have the .htaccess file under application this will stop you from accessing files in application directory!

InsiteFX
#3

[eluser]xerosis[/eluser]
Well I checked the link directly and it worked fine so .htaccess is there; but even when I give it direct link it still does not work right. Its really disturbing, should be simple.
#4

[eluser]xerosis[/eluser]
I have tried everything nothing seems to work.

It does create the folder 23 and it does even create the image, but the image is just a 1 kb file which has no data in it. Also I noticed that I should make it like so:

Code:
$this->s3->putObject('uploads/122222.jpg', 'adp-asset', 'storage/23/122222.jpg', S3::ACL_PUBLIC_READ, $location = false);

no need for adding './upload/122222.jpg' nothing works! The path is also accessible by .htaccess I have tested and also unlink works fine as well.

Can anyone help me out on this!? I have been working on it for hours with no result.
#5

[eluser]Gorelog[/eluser]
xerosis did you figure this out? I just started with AS3 and am experiencing the same thing. The files and directories are created, but the contents of the file is the path of the locally hosted file.

Thanks,
D
#6

[eluser]Gorelog[/eluser]
It needs the files contents. file_get_contents('uploads/122222.jpg') should work for you, but you'll probably need to use the full file path.

http://php.net/manual/en/function.file-get-contents.php




Theme © iAndrew 2016 - Forum software by © MyBB