WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

PHP ftp_mdtm () function


Definition and usage

The ftp_mdtm () function returns the last modification time of the specified file.

This function returns the last modification time of the file as a Unix timestamp, or -1 if an error occurred.

Syntax

  int   ftp_mdtm   (  resource $ ftp_stream  ,     string   $ remote_file  )  

parameters description
ftp_connection Required. Specifies the FTP connection to log in to.
file Required. Specifies the documents to be checked.


Tips and comments

Note: This function is not supported by all FTP servers.


Examples

<?php
$file = 'somefile.txt';

//Connect to server
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

  //Get the best modification time  
$ buff   =   ftp_mdtm   (  $ conn_id  ,   $ file  );  
  //A UNIX timestamp if successful, otherwise -1.  
  if     (  $ buff  ! =    -  1  )     { 
      //Output the last modification time of somefile.txt  
    echo   "$ file is best modified as:"    .   date   (  "F d YH: i: s."  ,   $ buff  );  
 }     else     { 
    echo   "Unable to get file modification time"  ;  
 }  
//close the connection
ftp_close($conn_id);
?>