PHP ftp_size() 함수
예시
FTP 서버의 파일 크기 가져오기:
<?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);
?>
정의 및 사용
ftp_size() 함수는 FTP 서버에 있는 지정된 파일의 크기를 반환합니다.
참고: 모든 FTP 서버가 이 기능을 지원하는 것은 아닙니다!
통사론
ftp_size(ftp_conn, file);
매개변수 값
Parameter | Description |
---|---|
ftp_conn | Required. Specifies the FTP connection to use |
file | Required. Specifies the server file to check |
기술적 세부 사항
반환 값: | 성공 시 파일 크기(바이트) 또는 오류 시 -1 |
---|---|
PHP 버전: | 4+ |
❮ PHP FTP 참조