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

0

1

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://[email protected]@domain.com/www.abcd.com/:attachment/:id/:style/:filename",

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

  }  
end

Why is this happening?

Chiles answered 5/11, 2015 at 9:30 Comment(11)
all these errors are due to connection error. you should first check you're FTP using FileZilla client.Steffaniesteffen
@LukyBoy-KU I am already checked my ftp in FileZilla client. its working fine there. this error is like if i put 5 photo for upload then i will get this error from 1/2 photo and others photos are uploaded properly. some times its working fine without error too.Chiles
try using passive FTP, Ruby net/ftp code failing to PUT a file because of errorSteffaniesteffen
I already did this passive FTP . but still facing this error.Chiles
please post you're file uploading code.Steffaniesteffen
View this link may be help get you understand your problem. check for error codes.Steffaniesteffen
@LukyBoy-KU see question i added my model code here.Chiles
maybe you're missing two switches in code. try this one. hope it'll help FTP Storage for Paperclip :ftp_connect_timeout => 5, # optional, nil by default (OS default timeout) & :ftp_ignore_failing_connections => true, # optional, false by defaultSteffaniesteffen
I added both those lines in my code and start uploading 20 photos than i got new error this time Paperclip::Storage::Ftp::NoServerAvailable :(Chiles
Let us continue this discussion in chat.Steffaniesteffen
@KaleemUllah maybe worth posting the summary from your chat as an answer so to help 'close' this questionSealey

© 2022 - 2024 — McMap. All rights reserved.