Bill Mustard wrote:
> 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
|