Rails Machine Wiki

Ftp Temp Error

If you get an error like this when trying to upload files via FTP:


A Net::FTPTempError occurred in some_class#some_method:

425 Unable to build data connection: Connection timed out

/usr/lib/ruby/1.8/net/ftp.rb:241:in `getresp'

You may notice that a blank file is created on the remote server, but the data is never transferred.

To solve, try using passive mode:


ftp = Net::FTP.open("ftp.domain.com") do |ftp|
    ftp.login
    ftp.passive = true
    # do ftp stuff
end