Using Net:FTP to upload a file causes a hang

Greetings,

I am attempting to use Net:FTP to upload a file to an FTP server. I have
managed to upload a file to a local "127.0.0.1" server without issue,
however when I try to upload to a remote server, the code hangs.

I've managed to upload the exact same file to the same remote server
using the same credentials using a command line ftp, so it isn't a
network failure.

Here is the code I am using:

[code]
puts "Connecting to ftp server"
ftp = Net::FTP.new(ftpHost)
ftp.passive
puts "Logging in"
ftp.login(ftpUsername, ftpPassword)
puts "Changing directory"
ftp.chdir(ftpDirectory)
puts "Uploading file"
ftp.putbinaryfile(filename, filename, 256) {
  print "#"
  STDOUT.flush
}
puts "Closing connection"
ftp.close()
puts "Done"
[/code]

What am I missing?

Peter

···

--
Posted via http://www.ruby-forum.com/.