开发者

Instantiating File from a remote url in a rails controller

开发者 https://www.devze.com 2023-01-03 16:14 出处:网络
Is there a way to have something like this: File.开发者_如何学编程new(\'http://hostname/myfile.zip\')

Is there a way to have something like this:

File.开发者_如何学编程new('http://hostname/myfile.zip')

inside a controller?


require 'open-uri'
file = open(URI.parse('http://www.google.com/intl/en_ALL/images/logo2.gif'))
puts file.size
=> 8558
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号