PHP ftp_size() İşlevi
Örnek
FTP sunucusundaki bir dosyanın boyutunu alın:
<?php
// connect and login to FTP server
$ftp_server = "ftp.example.com";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
$file = "serverfile.txt";
// get size of $file
$fsize = ftp_size($ftp_conn, $file);
if ($fsize != -1)
{
echo "$file is $fsize bytes.";
}
else
{
echo "Error getting file size.";
}
// close connection
ftp_close($ftp_conn);
?>
Tanım ve Kullanım
ftp_size() işlevi, FTP sunucusunda belirtilen bir dosyanın boyutunu döndürür.
Not: Tüm FTP sunucuları bu işlevi desteklemez!
Sözdizimi
ftp_size(ftp_conn, file);
Parametre Değerleri
Parameter | Description |
---|---|
ftp_conn | Required. Specifies the FTP connection to use |
file | Required. Specifies the server file to check |
Teknik detaylar
Geri dönüş değeri: | Başarı durumunda dosyanın boyutu (bayt cinsinden), hata durumunda -1 |
---|---|
PHP Sürümü: | 4+ |
❮ PHP FTP Referansı