Net_FTP::mdtm()

Net_FTP::mdtm() – returns the last modification date of a file.

Synopsis

require_once 'Net/FTP.php';

mixed Net_FTP::mdtm ( string $file , string $format = null )

Description

gives you the last modification-date of a file either as a unix timestamp or in a formated date.

Parameter

  • string $file - The file to check.

    string $format - A date()-function styled format-string.

Return value

mixed - the last modification date on success, otherwise PEAR::Error.

Throws

Several errors may be returned by mdtm. The errornumber is unspecific (until now) and will not tell you anything about the errormessage. Possible errors are:

Possible PEAR_Error values
Error message Description Solution
Filename '$file' seems to be a directory. The filename you gave the method does not reference a regular-file but a directory. Specify a correct filenamepath (eg. /my/file/path/foo.html, ../foo.html).
Could not get last-modification-date of '$file'. The last-modification date could not be determined by PHP. Reasons for this may be that your FTP-server does not support the used command or that you gave the function a non existent file as reference.
  • check the given file for existence
  • contact the FTP server's admin
Date-format failed on timestamp '$res'. The given format-string was not well formated. Check the documentation of the PHP function date().

Note

This function can not be called statically.

Example

Using mdtm()

<?php

  var_dump
($test->mdtm('/foo/bar'));

  
// returns the last modification time in german timeformat
  
var_dump($test->mdtm('/foo/bar''d.m.Y, H:i'));

?>
executes a command on the server. (Previous) returns the size in bytes of a file. (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.