Let's say I upload a file to S3 using Carrierwave in my Rails application. I need to make sure :
How can I achieve this?
You need to do it code itself. You need to track record of downloaded file.
For this you need to create a table that hold information for user and file that already downloaded.
To hide actual s3 url, You need to first read file in your code from s3 and available that file to user with send_data
.
xyz = Xyz.find(params[:id])
data = open(xyz_file_path).read
send_file data, filename: file_name_that_you_want,
type: file_content_type, stream: 'true',
:x_sendfile => true
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.