ftp_size

(PHP 3 >= 3.0.13, PHP 4, PHP 5)

ftp_size -- 返回指定檔案的大小

說明

int ftp_size ( resource ftp_stream, string remote_file )

ftp_size() 函數以位元組返回遠端檔案 remote_file 的大小。若果指定檔案不存在或發生錯誤,則返回 -1。有些 FTP 伺服器可能不支援此特性。

取得成功返回檔案大小,否則返回 -1。

例子 1. ftp_size() 例子

<?php
$file 
'somefile.txt';

// connect to the server
$conn_id ftp_connect($ftp_server);
$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);

$res ftp_size($conn_id$file);

if (
$res != -1) {
    echo 
"size of $file is $res bytes";
} else {
    echo 
"couldn't get the size";
}

ftp_close($conn_id);
?>

參見 ftp_rawlist()