问题描述
我在 send_data 方法中传递 disposition: 'attachment' 来下载图像,它可以在所有平台上完美运行但 iOS。在 iOs 中,它的行为就像 disposition: 'inline' 被传递了一样。我被卡住了,无法弄清楚。如果有人能提供帮助,那真是太棒了。
我使用 Rails 4.2.6 和 Ruby 2.3.4
我的代码是
<%= link_to "Download",blog_blogs_download_image_path,data: {turbolinks: false} %>
在控制器中
require 'open-uri'
url = 'resource_path'
data = open(url).read
send_data data,filename: "test_photo.jpg",disposition: 'attachment'
解决方法
AFAIU,事情就是这样。 iOS 中没有“下载”的概念。