Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to send a file to a FTP server using Perl. The program works almost well, but the file size changed (file size on remote host is different from localhost). After checking, i realize that: it's not the my Perl script's error but the FTP client's error.

Let's say: I have a computer (A) running Cent-Os 5. I want to send a wav file (802_20130511_111637.wav - 207,084 bytes) to a remote computer (B). The FTP server on (B) is File Zillar 0.9.41.

I did following commands from (A) console (for safety, I've changed hosts name and user name):

[root@abcxyz 1234]# ls -l
total 464
-rw------- 1 asterisk asterisk  99564 May  8 10:39 0913255236_20130508103929.wav
-rw------- 1 asterisk asterisk 127084 May  7 22:42 0918272810_20130507224217.wav
-rwxrwxrwx 1 asterisk asterisk  16488 May  7 16:45 1234.wav
-rw-r--r-- 1 asterisk asterisk 207084 May 11 11:17 802_20130511_111637.wav
[root@abcxyz 1234]# ftp
ftp> open xxx.xxx.xxx.xxx
Connected to xxx.xxx.xxx.xxx.
220 FileZilla Server version 0.9.41 beta
502 GSSAPI authentication not implemented
504 Auth type not supported
KERBEROS_V4 rejected as an authentication type
Name (xxx.xxx.xxx.xxx:root): my_user_name
331 Password required for my_user_name
Password:
230 Logged on
Remote system type is UNIX.
ftp> put 802_20130511_111637.wav
local: 802_20130511_111637.wav remote: 802_20130511_111637.wav
227 Entering Passive Mode (xxx,xxx,xxx,xxx,195,159)
150 Connection accepted
226 Transfer OK
207503 bytes sent in 0.029 seconds (7.1e+03 Kbytes/s)
ftp>

As you can see. The file size (at line 6) is 207084 bytes. But the size (at the almost last line) is 207503 bytes.

Exactly, the file size changed after send through FTP. I've downloaded two files above (one from (A) and one from (B) ) to another PC (running Windows). The one comes from (A) can be played well, but the one from (B) cannot.

Please correct me if I did any wrong. Why the file size changed although I've used native FTP client?

share|improve this question

migrated from stackoverflow.com May 13 '13 at 13:54

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

You never issued the bin command (or whatever your client uses), so it's performing line-ending translation.

share|improve this answer
    
Thanks @ikegami. This helps me a lot! –  user2372419 May 13 '13 at 9:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.