downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<ftp_siteftp_ssl_connect>
Last updated: Thu, 26 Jun 2008

ftp_size

(PHP 4, PHP 5)

ftp_size — Returns the size of the given file

Description

int ftp_size ( resource $ftp_stream , string $remote_file )

ftp_size() returns the size of the given file in bytes.

Note: Not all servers support this feature.

Parameters

ftp_stream

The link identifier of the FTP connection.

remote_file

The remote file.

Return Values

Returns the file size on success, or -1 on error.

Examples

Example #1 ftp_size() example

<?php

$file
= 'somefile.txt';

// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// get the size of $file
$res = ftp_size($conn_id, $file);

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

// close the connection
ftp_close($conn_id);

?>

See Also



add a noteadd a note User Contributed Notes
Returns the size of the given file
There are no user contributed notes for this page.




<ftp_siteftp_ssl_connect>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs