in Projects, Programming, Technology

send_file and remote files – Ruby on Rails code

Cache and relay images using:

require ‘uri’

class ImagesController < ApplicationController
# relays remote images so that we can encrypt them
def index
data = open(params[:src])
send_data, :type => data.content_type, :disposition => ‘inline’


Write a Comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.

  1. I am relatively new to rails.
    I was trying to let clients download using send_file from amazon s3. It was not working probably because send_file cannot work with remote files/urls.
    I was desperately searching for a solution.
    Your post has saved me. Thanks