It is not possible to verify which file is the most recent, because there is no such thing as the "uploaded time" attribute. You didn't mention anything about the FTP server, but if you have some level of control over the downloads, you can make sure that the latest time change is set at boot time. Regardless of whether this works with your FTP server and possibly with clients.
, , - :
$conn = ftp_connect('ftp.addr.com');
ftp_login($conn, 'user', 'pass');
$files = ftp_nlist($conn, '');
$mostRecent = array(
'time' => 0,
'file' => null
);
foreach ($files as $file) {
$time = ftp_mdtm($conn, $file);
if ($time > $mostRecent['time']) {
$mostRecent['time'] = $time;
$mostRecent['file'] = $file;
}
}
ftp_get($conn, "target.txt", $mostRecent['file'], FTP_ASCII);
ftp_close($conn);