2014-02-27 5 views
0

힌 내가이파일 다운로드

require 'open-uri' 
def index 
File.open('/target/path/to/downloaded.file', "wb") do |file| 
    file.write open('http://example.com/your.file').read 
end 
end 

할 루비에 내가 이것을 시도 파일을 다운로드 할 수 있지만, 내 index.html.erb에

를 작동하지 않는 방법에 어떤 아이디어를 하지만 여전히 아니다

답변

0

send_file 작업은 다음과 같이 작동합니다 :

send_file "/target/path/to/downloaded.file", 
      :filename => "your.file", 

도 몇 파라있다 ms 가능 :

  :type => 
      :x_sendfile => true 
관련 문제