Your CGI program may have received the whole file,
but did you remember
to close it before doing the ftp? If not, you may have
a buffering
problem. The put is sending everything that exists on the
disk, but there may be more in memory that hasn't been written out
yet. When your program terminates, the file will be closed,
and that last buffer will be
written. So when you go to examine the file on the server,
it'll be complete.