wrote a small perl script to upload / download files to & from Unix ( aix ),
the download works perfect, the \n on Unix is replaced with \r\l when downloaded, For download i have no issues

But when a text file is uploaded to Unix in ascii mode size of the file remains the same in Unix,
this should not be the case, the size should be smaller than windows as \r\l is treated as \n in unix,
i confired the same by uploading with the default windows ftp utility

the code is shown below , the codes relevent to error handling is removed for clarity

$g_FtpCnxn = Net::FTP->new($l_Server,Debug => 0); $g_FtpCnxn->login($l_Login ,$l_Passwd); $g_FtpCnxn->ascii; $l_Result = $g_FtpCnxn->put($l_SrcFile) $l_TgtFileName = "$l_TgtFile/$l_Result"; $l_ServerSize = $g_FtpCnxn->size($l_TgtFileName) # Size on Unix @s_temp = stat($l_SrcFile); $l_LocalSize = $s_temp[7]; # Size on Windows

A typical size mismatch after an upload is shown here

Unix Size : 89539 << Incorrect
Windows Size : 89539
Number of new lines in the file : 2839
Unix Size : 86700 << Correct / Expected Size
The expected size is acheived when uploaded through default ftp utility
thanks in advance for your suggestions
nanda

In reply to Ascii upload ruins the file by Monk_Novice

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.