Consider them in turn:
- Create file locally
- Copy it to a remote folder with a temporary extension
- Rename the deleted file to the original file name
Step 2 and 3 are as follows (using System.IO):
string OriginalExtension = ".ok", TemporaryExtension = ".dat"; string tmpFileRemote = RemoteFile.Replace(TemporaryExtension, OriginalExtension); File.Copy(fileName, RemoteFile, true); File.Copy(RemoteFile, tmpFileRemote, true); File.Delete(RemoteFile);
The first File.Copy file takes time. But since it does not block the actual file that people use, it does not block. The second File.Copy actually just renames the file and replaces the real file with the newly loaded one. File.Delete deletes the downloaded temporary file.
Hope this helps.
Adnan
source share