我已经做了文件上传谷歌驱动器,但在下载时遇到错误:如何使用paperclip-googledrive从谷歌驱动器下载文件?
ActionController::MissingFile: Cannot read file original_22_Wages372-817339(wages).pdf
我认为它没有得到谷歌驱动器路径。
附件型号:
has_attached_file :doc,
storage: :google_drive,
google_drive_credentials: "#{Rails.root}/config/google_drive.yml",
google_drive_options: {
public_folder_id: '0BwCp_aK6VhiaQmh5TG9Qbm0zcDQ',
path: proc { |style| "#{style}_#{id}_#{doc.original_filename}" }
}
控制器:
attachment = Attachment.find(params[:id])
send_file attachment.doc.path(:original),
filename: attachment.doc_file_name,
type: attachment.doc_content_type,
stream: 'true',
x_sendfile: true
在此先感谢
open(attachment.doc.url(:original))使用此功能可以下载文件,但有些文件会给出以下错误。为什么?Errno :: ENOENT:没有这样的文件或目录@ rb_sysopen - 没有图片来自/home/kedar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/open-uri.rb:36: in'initialize' – Dinesh 2015-02-24 05:53:42