Change language

PHP Ftp_mdtm () function

Syntax:
ftp_mdtm ($ftp_connection, $file) 
Parameter:this function takes two parameters as specified above and described below:
  • $ftp_connection:Required. Indicates an existing FTP connection.
  • $file:Required. It points to a file or path to a file on the remote server, i.e. on the FTP server from which the last modified one will be retrieved.
Returned value:Returns the last modified time as a UNIX timestamp on success, or -1 on error .Notes :
  • This function is available for PHP 4.0.0 and newer.
  • The following examples are not can be run in the online IDE. So try running PHP on some hosting server or localhost with the correct ftp server name.
  • This function does not work for directories. All servers may not support this feature.
Example :  
// Connect to the FTP server 
// Using the correct FTP server $ftp_server = "localhost" ;  
// Use correct ftp username $ftp_username = "user" ;  
// Use correct FTP password matching
// to the ftp username $ftp_userpass = "user" ;  
// File name or path for uploading to FTP server $file = "demo_test.txt" ;  
// Setting up ftp connection $ftp_connection = ftp_connect ( $ftp_server ) or die ( "Could not connect to $ftp_server" ); if ( $ftp_connection ) { echo "successfully connected to the ftp server!" ; // Login to the established connection // ftp user password $login = ftp_login ( $ftp_connection , $ftp_username , $ftp_userpass ); if ( $login ) { // Success check login echo "
logged in successfully! "
; // Save the last modified data to $last_mod $last_mod = ftp_mdtm ( $ftp_connection , $file ); if ( $last_mod ! = -1) { // Check if an error occurred // when getting the last modified data echo "
$file was modified on "
. date ( "F d YH: i: s." , $last_mod ). "." ; } else { echo "
could not get last modified."
; } } else { echo "
login failed! "
; } // Close connection if (ftp_close ( $ftp_connection )) { echo "
Connection closed Successfully!"
; } }
?>
Output: Link : https://www.php.net/manual/en/function.ftp-mdtm .php

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method