ID: 43211 Updated by: [EMAIL PROTECTED] Reported By: miccots at gmail dot com -Status: Open +Status: Feedback Bug Type: FTP related Operating System: * PHP Version: 5.2.4 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2007-11-07 12:42:40] miccots at gmail dot com Description: ------------ Hello. Function ftp_size() woks strange for files which size is mjre then 2^16 bytes. When checking size after uploading it returns -1. But if close and open connection it returns the correct result (after sprintf('%u', $size)); So, this function could not determine size of big file until reconnect. Reproduce code: --------------- <?php $start_time = microtime(TRUE); $ftp_ip = 'ftp_ip'; $local_file = 'local_file.fil'; $remote_file = 'file_1.fil'; $conn = ftp_connect($ftp_ip, 21); ftp_login($conn, 'anonymous','[EMAIL PROTECTED]'); ftp_pasv($conn, TRUE); echo "\n Time spent: ".(microtime(TRUE) - $start_time)."s... Trying to upload ".sprintf('%u', filesize($local_file))." bytes.\n"; echo "\n Time spent: ".(microtime(TRUE) - $start_time)."s... 1st attempt: ftp_put_returned: ".(ftp_put($conn, $remote_file, $local_file, FTP_BINARY)?'TRUE':'FALSE')."\n"; echo "\n Time spent: ".(microtime(TRUE) - $start_time)."s... Size of uploaded file before reconnect: ".sprintf('%u', ftp_size($conn, $remote_file))." (".ftp_size($conn, $remote_file).") bytes\n"; echo "\nReconnect...\n"; ftp_close($conn); $conn = ftp_connect($ftp_ip, 21); ftp_login($conn, 'anonymous','[EMAIL PROTECTED]'); ftp_pasv($conn, TRUE); echo "\n Time spent: ".(microtime(TRUE) - $start_time)."s... Size of uploaded file after reconnect: ".sprintf('%u', ftp_size($conn, $remote_file))." (".ftp_size($conn, $remote_file).") bytes\n"; ftp_close($conn); ?> Actual result: -------------- Time spent: 0.01035213470459s... Trying to upload 3532439032 bytes. Time spent: 0.010672092437744s... 1st attempt: ftp_put_returned: FALSE Time spent: 661.11731815338s... Size of uploaded file before reconnect: 4294967295 (-1) bytes Reconnect... Time spent: 661.12095808983s... Size of uploaded file after reconnect: 3532439032 (-762528264) bytes ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43211&edit=1