PHP Amazon S3 access private files through URL

后端 未结 3 1343
走了就别回头了
走了就别回头了 2021-01-26 09:13

I\'m using AWS PHP sdk to save images on S3. Files are saved privately. Then, I\'m showing the image thumbnails using the S3 file url in my web application but

3条回答
  •  北海茫月
    2021-01-26 09:36

    You will need to access the files through a script on your server. That script will do some kind of authentication to make sure the request is valid and you want them to see the file. Then fetch the file from S3 using a valid IAM profile that can access the private files. Output the file

    Instead of requesting the file from S3 request it from http://www.yourdomain.com/fetchimages.php?key=8498439834

    Then here is some pseudocode in fetchimages.php

    
    

提交回复
热议问题