Using send_file to download a file from Amazon S3?

前端 未结 7 1581
感动是毒
感动是毒 2020-11-29 18:10

I have a download link in my app from which users should be able to download files which are stored on s3. These files will be publicly accessible on urls which look somethi

7条回答
  •  再見小時候
    2020-11-29 18:36

    def download_pdf @post= @post.avatar.service_url

    send_data(
    
        "#{Rails.root}/public/#{@post}",
        filename: "#{@post}",
        type: "image/*",
        disposition: 'inline', stream: 'true', buffer_size: '4096'
    )
    

    end

提交回复
热议问题