Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > net::FTP fails me (newbe question)

Reply
Thread Tools

net::FTP fails me (newbe question)

 
 
Bill Mustard
Guest
Posts: n/a
 
      10-16-2005
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
 
Reply With Quote
 
 
 
 
wmustard@gmail.com
Guest
Posts: n/a
 
      10-16-2005

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Constant.t fails 240 of 272 tests and recurs.t fails 1 of 25 tests on HPUX using perl 5.8.7 dayo Perl Misc 11 12-16-2005 09:09 PM
slideshow fails, Firefox debugger also fails lkrubner@geocities.com Javascript 2 12-23-2004 06:22 PM
Wireless Zero Configuration Servoce fails to start andrew Wireless Networking 0 07-28-2004 03:08 PM
IAS fails with certs from Stand Alone CA Harrison Midkiff Wireless Networking 2 07-22-2004 09:45 PM
Forms Authentication Fails Between ASP.NET 1.0 and 1.1 Applications (Cookie Decryption Fails) John Saunders ASP .Net 1 11-18-2003 03:25 PM



Advertisments