Example:
ftp_get($ftp, 'movies.txt', 'MO'.date('md').'.txt', FTP_ASCII);
if ftp_get
can't find a file MO1115.txt
on remove server and the movies.txt
file exists on local server, it ends up being deleted. Is this the expected behavior?
Example:
ftp_get($ftp, 'movies.txt', 'MO'.date('md').'.txt', FTP_ASCII);
if ftp_get
can't find a file MO1115.txt
on remove server and the movies.txt
file exists on local server, it ends up being deleted. Is this the expected behavior?
here is what i found on http://php.net/manual/en/function.ftp-get.php
*The zero size file is not a side effect. When the ftp_get starts the first thing it does is to create the inode/file which it will stream the data too and that is a zero size file with the nname you specified for the local file. When the download fails it leaves the file in place.*
So i would guess that the best way to handle this is to use a temp file and then check if it was written to or not. if yes copy if over the old file, if not simply remove the temp file