note 92127 modified in function.ftp-size by danbrown
| From: | danbrown@php.net | Date: | Fri, 10 Jul 2009 11:49:16 +0000 |
| Subject: | note 92127 modified in function.ftp-size by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158141@lists.php.net to get a copy of this message | ||
To overcome the 2GB file size limit, you can open your own socket to get the file size of a large
file. Quick and dirty script:
<?php
$socket=fsockopen($hostName, 21);
$t=fgets($socket, 128);
fwrite($socket, "USER $myLogin\r\n");
$t=fgets($socket, 128);
fwrite($socket, "PASS $myPass\r\n");
$t=fgets($socket, 128);
fwrite($socket, "SIZE $fileName\r\n");
$t=fgets($socket, 128);
$fileSize=floatval(str_replace("213 ","",$t));
echo $fileSize;
fwrite($socket, "QUIT\r\n");
fclose($socket);
?>
--was--
To overcome the 2GB file size limit, you can open your own socket to get the file size of a large
file. Quick and dirty script:
$socket=fsockopen($hostName, 21);
$t=fgets($socket, 128);
fwrite($socket, "USER $myLogin\r\n");
$t=fgets($socket, 128);
fwrite($socket, "PASS $myPass\r\n");
$t=fgets($socket, 128);
fwrite($socket, "SIZE $fileName\r\n");
$t=fgets($socket, 128);
$fileSize=floatval(str_replace("213 ","",$t));
echo $fileSize;
fwrite($socket, "QUIT\r\n");
fclose($socket);
http://php.net/manual/en/function.ftp-size.php