Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).

Verify file before download

no avatar
User

fizzlefry

Posts

2

Joined

Thu Apr 19, 2012 8:36 am

Verify file before download

by fizzlefry » Tue Nov 05, 2013 7:44 am

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.
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: Verify file before download

by support2 » Tue Nov 05, 2013 8:44 am

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.

Who is online

Users browsing this forum: No registered users and 24 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron