Search code examples
amazon-s3fine-uploaderaws-php-sdk

Initial file list not showing actual files


I have implemented initFiles to display already s3 uploaded files, but actual image thumbnails are not showing. Also, I can not click on the default thumbnail that is shown (see image). How can I see actual images and link works?

I have below JS snippet

session: {
        endpoint: "http://localhost/app/ci/php-s3-server/endpoint-cors.php?filelist"
    },

Response from endpoint-cors.php?filelist call is...

[{"name":"art_collage.png","uuid":"e3554aa0-c025-4653-bb71-4afe9d979f06","s3Key":"test\/e3554aa0-c025-4653-bb71-4afe9d979f06.png","s3Bucket":"kidkivetest"},{"name":"process_step_2.png","uuid":"e5d84dd7-458c-4601-9168-e16e747134d0","s3Key":"test\/e5d84dd7-458c-4601-9168-e16e747134d0.png","s3Bucket":"xx_my_bucket_xx"}]

S3 bucket structure has 2 images:

All Buckets /xx_my_bucket_xx/test
e3554aa0-c025-4653-bb71-4afe9d979f06.png
e5d84dd7-458c-4601-9168-e16e747134d0.png

Solution

  • If you would like to display thumbnails in your initial files list, you must provide a thumbnailUrl for each file in the list. For example:

    [{"name":"art_collage.png","uuid":"e3554aa0-c025-4653-bb71-4afe9d979f06","s3Key":"test\/e3554aa0-c025-4653-bb71-4afe9d979f06.png","s3Bucket":"kidkivetest", "thumbnailUrl": "http://mys3bucket.com/art_collage.png"}...]