net::FTP fails me (newbe question)

B

Bill Mustard

I am running ruby 1.8.2 (2004-12-25) [i386-mswin32] on winXp SP2+ and
using ruby to do a bunch of website formatting maintenance and general
tidying up. The last step is to send the changed files to the site.
All of the files end up truncated! the code bloc I am using is: (names
and places changed to protect the innocent)

if changed != {}
print "Send to web site? [Y,n]"
a = $stdin.gets.chomp
if a =~ /^y.*/i || a == ''
ftp = Net::FTP.new('website.place')
ftp.login('name','password')
ftp.chdir('www/fileplace')
changed.each_key {|f|
print f
ftp.puttextfile(f)
puts ": " + ftp.size(f).to_s + " of #{changed[f]}"
}
ftp.close
end
end

Any help is appreciated.

Thanks in advance.

Bill Mustard
 
W

wmustard

Bill said:
I am running ruby 1.8.2 (2004-12-25) [i386-mswin32] on winXp SP2+ and
using ruby to do a bunch of website formatting maintenance and general
tidying up. The last step is to send the changed files to the site.
All of the files end up truncated! the code bloc I am using is: (names
and places changed to protect the innocent)

if changed != {}
print "Send to web site? [Y,n]"
a = $stdin.gets.chomp
if a =~ /^y.*/i || a == ''
ftp = Net::FTP.new('website.place')
ftp.login('name','password')
ftp.chdir('www/fileplace')
changed.each_key {|f|
print f
ftp.puttextfile(f)
puts ": " + ftp.size(f).to_s + " of #{changed[f]}"
}
ftp.close
end
end

Any help is appreciated.

Thanks in advance.

Bill Mustard

I changed "ftp.puttextfile(f)" to "ftp.putbinaryfile(f,f,1024)"
even though they are text files, and the transfer works!

Thanks
Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top