getting random error while upload photo with paperclip on my ftp server

与世无争的帅哥 提交于 2019-11-28 06:27:50

问题


I used gem "paperclip" for upload images and gem "paperclip-storage-ftp" for store images on my own ftp server. It worked fine for a while, but now I am getting random errors, when I upload photos.

Sometimes this

Net::FTPReplyError - 150 Connecting to port 3270

Sometime this

Net::ReadTimeout - Net::ReadTimeout:

Sometime this

Paperclip::Storage::Ftp::NoServerAvailable

.. and sometimes this:

Net::FTPPermError - 500 ?

Model

class AlbumPhoto < ActiveRecord::Base
  has_attached_file :photo, {
    # Choose the FTP storage backend
    :storage => :ftp,
    :path => "www.abcd.com/:attachment/:id/:style/:filename",
    :url => "ftp://abcd@domain.com@domain.com/www.abcd.com/:attachment/:id/:style/:filename",

    :ftp_servers => [
      {
        :host => "domain.com",
        :user => "abcd@domain.com",
        :password => "abcd123",
        :passive => true
      }
    ],
    :styles => { :medium => "300x300^", :thumb => "100x100^" ,:large => "400x400^"},

  }  
end

Why is this happening?

来源:https://stackoverflow.com/questions/33540851/getting-random-error-while-upload-photo-with-paperclip-on-my-ftp-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!