Generated a presigned_url for a csv file on S3. If I put the url in the browser it opens without any issues.
I want the user to be able to click a link and have the file download onto their computer without touching the server if possible.
The following fails with the error:
ActionController::MissingFile at /foo/1/download
Cannot read file FILE_URL
class FooController < ApplicationController
def download
@foo = Foo.find_by( id: params[:id] )
send_file( @foo.url, filename: @foo.filename )
end
end
This redirect works without a problem and the file is displays in the browser.
class FooController < ApplicationController
def download
@foo = Foo.find_by( id: params[:id] )
redirect_to @foo.url
end
end