Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails send_文件可以工作,但不允许用户指定目标文件名/文件夹_Ruby On Rails - Fatal编程技术网

Ruby on rails send_文件可以工作,但不允许用户指定目标文件名/文件夹

Ruby on rails send_文件可以工作,但不允许用户指定目标文件名/文件夹,ruby-on-rails,Ruby On Rails,在我的rails应用程序中,我允许用户下载文件 def download options = { :filename => @file_name, :type => 'application/zip', :disposition => 'attachment' } send_file(@path, options) end def下载 选项={:filename=>@file_name,:type=>'application/zip',:disposition=>'attachment'

在我的rails应用程序中,我允许用户下载文件

def download options = { :filename => @file_name, :type => 'application/zip', :disposition => 'attachment' } send_file(@path, options) end def下载 选项={:filename=>@file_name,:type=>'application/zip',:disposition=>'attachment'} 发送_文件(@path,options) 结束
这将起作用,用户将看到一个打开或保存文件对话框。但是,用户从未有机会为下载的文件指定文件名或目标文件夹。有没有一种方法可以让我使用rails标准的send_file实现这种额外的灵活性?

您必须在浏览器上设置这些设置