I'm trying to create controllers action that responds with local vide开发者_Python百科o file that is outside of the applications public directory. What I have now is
def video
render :text => File.read('D:/test.mp4'), :content_type => 'video/mp4'
end
browser recognizes that it should threat response as a video file however video content is not played appropriately. Am I missing something here? Do you know some better/other solution? Copying each file to the public directory seems to be a workaround but it also seems to be a really bad idea ). Thanks.
You should use send_file or send_data instead.
精彩评论