|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-10-28 13:20 UTC] jani@php.net
[2008-11-05 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 02:00:01 2025 UTC |
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','anonymous@mail.ml'); 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','anonymous@mail.ml'); 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