Created
January 25, 2012 17:46
-
-
Save pke/1677550 to your computer and use it in GitHub Desktop.
Downloading file in padrino/sinatra
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server.controllers :installer, :parent => :licenses do | |
before do | |
puts params.inspect | |
@license = License.get(params[:license_id]) | |
halt 404, "License not found" unless @license | |
end | |
get :index, :with => :token do | |
halt 404, "File not found" if @license.installer.token != params[:token] | |
# installer.path is something like c:/installers/install.exe | |
send_file(@license.installer.path) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment