java - AWS S3 key issue for uploaded file -


i've question on s3 file key. i'm uploading image file key being url of image. here's code snippet.

 amazons3 s3 = new amazons3client(new basicawscredentials(access_key, secret_key)); putobjectrequest putobj = new putobjectrequest(bucket, key, createinputstream(image_path), createmetadata("image/jpeg")); putobj.setcannedacl(cannedaccesscontrollist.publicread); putobjectresult result = s3.putobject(putobj); 

now, here's sample key : image/staging/file/guid1234

and image name : test.jpeg

now, how looks in s3 after upload. testbucket/image/staging/file/guid1234

there's no reference of image name. image url shows http://testbucket.s3.amazonaws.com/image/staging/file/guid1234

as can see, there's no reference of image name, though shows image in browser correctly. need embed url in html page, , doesn't lool ok if image name missing.

just wondering, if there's way preserve image name url looks http://testbucket.s3.amazonaws.com/image/staging/file/guid1234/test.jpeg

any pointer highly appreciated.

thanks

with s3, key should entire name want object have. in case, appears (i don't know sure since have not included code) key = image/staging/file/guid1234. if want object named image/staging/file/guid1234/test.jpeg, need set value of key image/staging/file/guid1234/test.jpeg


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -