Hi all,

Does anyone have experience using Net::FTP to transfer a jpeg file? I am
logging onto another Mac that is running WebSTAR. The jpeg transfer appears to
go okay, but the jpeg is somehow corrupted during the transfer. In the Net::FTP
documentation, it says that images should be sent as binary. So I changed the
type to binary:  $ftp->binary();

When I try to view the image after it is transferred, QuickTime says it is
corrupted and Photoshop says "Could not open "s01-8859.jpg" because a JPEG
marker segment length is too short (the file may be truncated or incomplete)."

When I do this using Fetch, it uses Raw Data as the format, and there is no
problem. What could be happening in the Perl program to cause a corruption
problem?

This program is running on a Mac, and it is transferring the image file to
another Mac running WebSTAR FTP. Maybe WebSTAR does not pay attention to the
$ftp->binary() request from the client?

Thanks for your help,
Kathy Richmond


Here is the code:

sub ftpFiles {

        my $ftp = Net::FTP->new("myserver.domain.org") or die "Can't
connect:$@\n";
        $ftp->login("DropClient", "guess") or die "Can't login: 
$ftp->message";

        $ftp->binary();

        foreach my $file (@ARGV) {

                $fileName = basename($file);
                
                $ftp->put($fileName) or die "Can't put: $fileName 
$ftp->message\n"; 

        }

}

-If this all sounds familiar to you, I was struggling with it last year and had
to leave the project until now!

Reply via email to