DECLARE INTEGER InternetOpen in WinINet.dll ; STRING cAgent, INTEGER nType, STRING cProxy, STRING cBypass, INTEGER nFlags DECLARE INTEGER InternetCloseHandle in WinINet.dll ; INTEGER nInternetHandle DECLARE INTEGER InternetConnect in WinINet.dll ; INTEGER nInternetSession, STRING cServer, INTEGER nPort, ; STRING cUserName, STRING cPassword, INTEGER nService, INTEGER nFlags, INTEGER nContext DECLARE INTEGER FtpSetCurrentDirectory IN WinINet.dll ; INTEGER nFtpSession, STRING cDirectory DECLARE INTEGER FtpOpenFile IN WinINet.dll ; INTEGER nFtpSession, STRING lpszFileName, INTEGER nAccess, INTEGER NFlags, ; INTEGER nContext DECLARE INTEGER InternetWriteFile IN WinINet.dll ; INTEGER nFile, STRING cBuffer, ; INTEGER nToWrite, INTEGER @ nWritten lnSession = InternetOpen("Wininet",0,.NULL.,.NULL.,0) * set as appropriate lcServer = "myserver" lcUserName = "login" lcPassword = "password" lcDir = "/public" lcFile = "somefile.bin" lcLocalFile = "d:\temp\somefile.bin" lnBufferSize = 1024 IF lnSession!=0 lnFTPSession = InternetConnect(lnSession,lcServer,21,lcUserName,lcPassword,1,0x08000000,0) IF lnFTPSession!=0 IF FtpSetCurrentDirectory(lnFTPSession,lcDir)!=0 * open the file for upload (both local and remote) lnRemote = FtpOpenFile(lnFTPSession,lcFile,0x40000000,2,0) lnLocal = FOPEN(lcLocalFile,0) IF lnRemote!=0 AND lnLocal!=-1 * we got valid handles, so we may start to send the file lnFileLength = FSEEK(lnLocal,0,2) FSEEK(lnLocal,0,0) lnUploaded = 0 * while there is something to upload DO WHILE lnUploaded<lnFileLength lcBuffer = FREAD(lnLocal,lnBufferSize) lnWritten = 0 InternetWriteFile(lnRemote,lcBuffer,LEN(lcBuffer),@lnWritten) lnUploaded = lnUploaded+LEN(lcBuffer) * show progress (pretend this is a progress bar...) WAIT WINDOW "Uploaded so far: "+LTRIM(STR((lnUploaded*100/lnFileLength)))+"%" NOWAIT ENDDO * terminate upload InternetCloseHandle(lnRemote) FCLOSE(lnLocal) WAIT WINDOW "Done" NOCLEAR ENDIF ENDIF InternetCloseHandle(lnFTPSession) ENDIF InternetCloseHandle(lnSession) ENDIFbye