I have an app which has been working without errors for a number of months. The machine this app is used on was recently infected by a ransom virus - don't know how but that is not the issue. I have cleared the virus and it's associated files and the machine is back to full health except that the upload program only uploads an empty file. There are no errors, it just fails to upload any content in the file - all very odd and I ws wondering if anyone could offer any suggestions as to where the problem lies.
I have popped some wait windows in there to see what is happening and all seems to be running through the right path but only uploading an empty file. I have deleted te blank file off the server and each upload is replaced with a blank file.
This app is a variation of an FTP program and loads files from various locations to several servers and the result is the same loading different files to different servers.
Keith
I have popped some wait windows in there to see what is happening and all seems to be running through the right path but only uploading an empty file. I have deleted te blank file off the server and each upload is replaced with a blank file.
This app is a variation of an FTP program and loads files from various locations to several servers and the result is the same loading different files to different servers.
Code:
PROCEDURE UPLOAD
LNXFERTYPE = 1
MESSY=0
DECLARE INTEGER InternetOpen IN wininet.DLL;
STRING sAgent,;
INTEGER lAccessType,;
STRING sProxyName,;
STRING sProxyBypass,;
STRING lFlags
DECLARE INTEGER InternetCloseHandle IN wininet.DLL INTEGER hInet
DECLARE INTEGER InternetConnect IN wininet.DLL;
INTEGER hInternetSession,;
STRING lcHost,;
INTEGER nServerPort,;
STRING lcUser,;
STRING lcPassword,;
INTEGER lService,;
INTEGER lFlags,;
INTEGER lContext
DECLARE INTEGER FtpPutFile IN wininet.DLL;
INTEGER hConnect,;
STRING lpszLocalFile,;
STRING lpszNewRemoteFile,;
INTEGER dwFlags,;
INTEGER dwContext
PUBLIC HOPEN, HFTPSESSION
IF CONNECT2FTP (LCHOST, LCUSER, LCPASSWORD)
IF FILE(SORSFILE)
SORSFILE=LOWER(SORSFILE)
IF FTPPUTFILE(HFTPSESSION, SORSFILE,DESTFILE, LNXFERTYPE, 0) = 1
WAIT WINDOW 'File '+SORSFILE+' Transferred' nowait
MESSY = 1
ELSE
WAIT WINDOW 'File '+SORSFILE +' TO '+ DESTFILE+' No transfer' nowait
MESST = 2
ENDIF
ELSE
WAIT WINDOW 'No file' nowait
MESSY = 3
ENDIF
= INTERNETCLOSEHANDLE (HFTPSESSION)
= INTERNETCLOSEHANDLE (HOPEN)
ELSE
WAIT WINDOW 'Cannot Connect' nowait
MESSY=4
ENDIF
ENDPROC
FUNCTION CONNECT2FTP (LCHOST, LCUSER, LCPASSWORD)
* open access to Inet functions
HOPEN = INTERNETOPEN ("vfp", 1, 0, 0, 0)
IF HOPEN = 0
WAIT WINDOW "Unable to get access to WinInet.Dll" NOWAIT
MESSY = 5
RETURN .F.
ELSE
WAIT WINDOW "Connection Made" nowait
ENDIF
HFTPSESSION = INTERNETCONNECT (HOPEN, LCHOST,;
0, LCUSER, LCPASSWORD, 1, 0, 0) &&... 1 = ftp protocol
IF HFTPSESSION = 0
* close access to Inet functions and exit
= INTERNETCLOSEHANDLE (HOPEN)
MESSY = 6
WAIT WINDOW "ftp " + LCHOST + " is not available" nowait
RETURN .F.
ELSE
WAIT WINDOW "Connected to " + LCHOST nowait
ENDIF
RETURN .T.
RETURN
Keith