Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2k views
in .NET FTP by (140 points)
I have written a .NET application using edtFTPnet FREE. This program works almost flawlessly, with one exception. If a file is being uploaded at the same time the user requests a download, the system will attempt the download. In my example, I had a user uploading a CSV file. This file had just begun the upload process when a different user logged in and initialized a download of that specific directory's contents., which contained the unfinished CSV file. The system actually went so far as to allow the download. When I attempted to open the CSV, I received an error stating the file might be corrupt. When I allowed it continue the open process, the entire file was completely empty. But when I kicked off the download command again, it pulled the completed file, because the file had completed uploading. So what I was looking to do was call for some sort of a check before downloading. Please excuse my ignorance with FTP logic but I don't know what I would need to do, if anything, to accomplish this. Otherwise, I'll keep running into the same issue when users don't follow directions. Is there some way to lock the file until the upload is complete, blocking any additional users from attempting a download? I really appreciate any help ion this matter.

1 Answer

0 votes
by (162k points)
Unfortunately FTP is usually not transactional, so it is common to run into this problem.

One solution is to upload to a temporary filename, and rename it once the upload is complete. That way you know that if the file exists, it is all there.

Categories

...