The files concerned got onto the server via some PHP on a web server that opened a file for append, wrote some data, closed it and sometime later did it again (and again) like this:
$myfile = fopen("Afile.txt", "a") or die("Unable to open file!");
fwrite($myfile, $stuff1."\r\n");
fwrite($myfile, $stuff2."\r\n");
...
fwrite($myfile, "stuffN"."\r\n");
fclose($myfile);
(up to an hour passes)
$myfile = fopen("Afile.txt", "a") or die("Unable to open file!");
fwrite($myfile, $stuff11."\r\n");
fwrite($myfile, $stuff12."\r\n");
...
fclose($myfile);
I noticed that the incomplete files always had complete sessions/records - just not enough of them while the FTP client got them all.
Eventually I dug into the documentation for FtpGetFile and found there was a flag INTERNET_FLAG_RELOAD I could set which "Forces a download of the requested file, object, or directory listing from the origin server, not from the cache."
That fixed it :-)
No comments:
Post a Comment