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

Common xlabel/ylabel for matplotlib subplots

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

12 answers

NUMPYNUMPY

Flake8: Ignore specific warning for entire file

12 answers

NUMPYNUMPY

glob exclude pattern

12 answers

NUMPYNUMPY

How to avoid HTTP error 429 (Too Many Requests) python

12 answers

NUMPYNUMPY

Python CSV error: line contains NULL byte

12 answers

NUMPYNUMPY

csv.Error: iterator should return strings, not bytes

12 answers


Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

sin

How to specify multiple return types using type-hints

exp

Printing words vertically in Python

exp

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries

cos

Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically