I've run into this same problem and also traced it to ftpsendfileex. Even after FTPClose() is called, the file being uploaded is not released.
Within ftpsendfilex, this line of code locks the file.
lhFile = FOPEN(TRIM(lcSourceFile))
After the failure, the memvar lhFile is released, but the file is still locked. My logs show the file remains locks for more than 24 hours, so there isn't any timeout in play.
Closing the file before releasing the handle solved the problem.
*** And write out each chunk lnSize=LEN(lcWriteBuffer) lnBytesRead = 0 lnRetval=InternetWriteFile(hFTPFile,; lcWriteBuffer,; lnSize,; @lnBytesRead) IF (lnRetVal = 0) THIS.nError = GetLastError() THIS.cErrorMsg = THIS.GetSystemErrorMsg() <b> * Unlock the file before exiting. Bob 10/6/2006 FCLOSE(lhFile) </b> RETURN THIS.nError ENDIF
FtpClose() should close the connection and release the file, unless there was a problem with the upload in which case WinInet may hang on to the file handle for some time.
Just for kicks I just tried this myself here by starting an upload and pulling the network connection. I get the the same error, but the file properly releases as long as FTPClose() is called and I can send again right away.
If you're worried about this scenario, you can copy the file to a different location and giving it a unique filename before sending it up to the server. Then delete it when your done. In the rare case when there is a problem you end up having an open file that eventually releases from WinInet.
+++ Rick ---
I am using West Wind FTP class (wwIPStuff) to uploading/downloading files from local to FTP Server.
As a test case, I uploaded 16 MB file called (Ptrack.zip) into FTP Server through the following FTP COmmand FTPSendFIleEx(). While uploading, if i disconnect the FTP Server, system showing the FTP Error Message "The Connection with the Server was terminated abnormally - 12030.". After getting this error message, I closed the FTP Connection and reopen once again and try to upload the same file. WHile doing this system showing the error message "Source file doesn't exist or is in use..".
The above error, raising at the time of Fopen(filename) Under wwFtp.ftpSendFileEx().
How to close the source file properly and repeat the uploading process. Please send me the Solution to firstname.lastname@example.org