Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 02-02-2010
Member
 
Join Date: Apr 2008
Posts: 2,001
Use of the ftp_size() : PHP

Hi, How are you all. I have the knowledge of the HTML language. But I do not know anything about the PHP language. I have to learn that how could I came to know the size of the transferring files in the PHP. So, I would like to know about the ftp_size() function of the PHP. I also would like to know how can I implement the ftp_size() function in the coding how the ftp_size() function find the size of the file that being transferring. Therefore, If anyone knows about the ftp_size() function then reply me!!!!
Reply With Quote
  #2  
Old 02-02-2010
Member
 
Join Date: May 2008
Posts: 2,293
The ftp_size() : PHP

Hello, The size of a specific file on the server of FTP can be returned by the ftp_size() function. On error, the size of the file can be in -1 or bytes by the ftp_size() function. The syntax of the ftp_size() function can be as follows :
ftp_size(ftp_connection,file)
In above syntax, the ftp_connection can be required that describes the FTP connection to use. The file can be required that describes the file to check.
Reply With Quote
  #3  
Old 02-02-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
Program : ftp_size()

The ftp_size() function can not be supported by the all of the File Transfer Protocol server. The following code of line describes you about the ftp_size() function :
Code:
<?php
$cn = ftp_connect("ftp.tsftp.com") or die("Can not connect");
ftp_login($cn,"adm","et4567");
echo ftp_size($cn,"tst.txt");
ftp_close($cn);
?>
The output generated by the above code above can be :
Code:
160
Reply With Quote
  #4  
Old 02-02-2010
Member
 
Join Date: May 2008
Posts: 2,383
Use of the ftp_size()

The parameters of the ftp_size() function can be the ftp_stream and the remote_file. The ftp_stream can be the link identifier of the FTP connection.
The remote_file can be the remote file.
Code:
<?php
$fle = 'smfil.txt';
$cnid = ftp_connect($ftp_server);
$lgn_rslt = ftp_login($cnid, $ftpusrnm, $ftpusrpas);
$rs = ftp_size($conn_id, $fle);
if ($rs != -1) {
    echo "size of $file is $res bytes";
} else {
    echo "couldn't get the size";
}
ftp_close($cnid);
?>
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #5  
Old 02-02-2010
Member
 
Join Date: Feb 2008
Posts: 1,848
The ftp_size() : PHP

The ftp_size() function of the PHP can sends a " size " command to the FTP server. The size of the ftp_size() function can be returned in bytes.
Code:
$ftpStrm = ftp_connect("m.ftp.server");
$lgnRslt = ftp_login($ftpStrm, "Username", "Password");
if ($lgnRslt) 
{
   $filnm = " remot.txt ";
   $siz = ftp_size($ftpStrm, $filnm);
   print "Remote file '$filnm' is $size bytes large.";
}
ftp_quit($ftpStrm);
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search



All times are GMT +5.5. The time now is 06:42 PM.