【发布时间】:2023-04-08 07:21:01
【问题描述】:
我在这里有这个动作:
def download
send_file 'C:/Sites/solver/public/test.zip'
end
当我从我的 html 执行它时,没有任何反应,也没有下载任何内容。
但这是它产生的日志:
Started POST "/ssh/download" for 127.0.0.1 at 2014-04-03 11:06:17 -0400
Processing by SshController#download as */*
Sent file C:/Sites/solver/public/test.zip (0.0ms)
Completed 200 OK in 5ms (ActiveRecord: 0.0ms)
任何人都可以帮助我了解缺少什么?
谢谢!
【问题讨论】:
-
试试
send_file '/public/test.zip' -
你怎么称呼那个动作(下载)?我假设您正在建立一个链接?发布该代码可能会有所帮助。
-
Windows 不使用 \ 来分隔文件路径,而不是 /?
-
BroiStatse,你的方法给了我一个 MissingFile : cannot read file /public/test.zip 错误。
-
如果我使用 windows 的 \ 它会给我 MissingFile 错误
标签: ruby-on-rails ruby sendfile