Another day….. Today’s kick in the nether regions was using Net::FTP::Recursive which was defaulting to ascii transfer mode when doing a bulk website transfer. The issue was not with the text (html type) files but with the images. I believe then problem was in transferring the data from a Windows web server t a FreeBSD Apache web server. In ascii mode the system changes line ending as it sees fit, however the binary mode just moves the data ‘as is’. It wasn’t immediately obvious how to change the transfer mode of the Net::FTP::Recursive object and a search of Google didn’t do much either. Here is what we did in the end:
#! /usr/bin/perl -w use strict; use Net::FTP::Recursive; my $ftp = Net::FTP::Recursive->new("my.ftp.host", Debug => 0) or die "Cannot connect to my.ftp.host: $@"; # # there is a load of code not relevant to the post # # $ftp->login("username","password") or die "Cannot login ", $ftp->message; $ftp->binary(); $ftp->rget(); $ftp->quit;
So the line $ftp->binary();
was the key and all images fixed!