I've build an FTP class in PHP with a function to download files from the FTP server.
This is the function so far
public function downloadData($serverFile, $localPath)
{
$fileName = basename($serverFile);
$file = $localPath.$fileName;
$download = false;
if(!file_exists($file))
{
// try to download $server_file and save to $local_file
if(ftp_get($this->connection_id, $file, $serverFile, FTP_BINARY)) {
$download = true;
}
}
return $download;
}
Basically it works fine, but when saving the data the "last change date" of the file is set to the current date/time. I somehow want to prevent this, because the original date is important for my needs.
Is there a way to keep the original modified date of the file?