use IO::File; my $fh = IO::File->new_tmpfile; $image->Write(file => $fh); seek($fh, 0, 0); $ftpSession->put($fh, $filename);