我正在尝试允许用户上传一个包含xsl样式表的压缩文件夹。然后,我想要解压缩该文件夹并将其保存在Rails.root/public/xsl/folderName
中
这是我在我的行动中尝试的:
require 'zip'
Zip::File.open(params[:stylesheet].tempfile) do |zipFile|
zipFile.each do |file|
path = File.join(Rails.root.join('public','xsl'),file.name)
File.open(path, 'wb') do |f|
f.write(file)
end
end
end
我去找Zip::Error: Zip end of central directory signature not found from /GEMS/gems/rubyzip-1.3.0/lib/central_directory.rb:143:in `get_e_o_c_d`
此错误发生在代码的第一行。我已经尝试过通过7Zip压缩文件夹,并将文件夹发送到Window的“压缩(压缩)文件夹”中。
谢谢!
发布于 2021-02-13 13:56:37
Zip::Error: Zip end of central directory signature not found from /GEMS/gems/rubyzip-1.3.0/lib/central_directory.rb:143:in get_e_o_c_d
https://stackoverflow.com/questions/61483583
复制相似问题