proc main integer iStatus ;Integer to hold $FTPCONNECT results integer iFTPSuccess = 0 ;Flag to determine if upload was successful string sPath ;Path to upload files from string sFile ;File to upload string sData ;String to hold data from FTP filelist string sFileSpec ;String to hold path and name of filelist data string sConnection ;Connection Directory entry we wish to dial sFileSpec = $PWLOCALPATH ;Set path to Procomm Plus directory strcat sFileSpec "\FILELIST.TXT" ;Add filename to path sPath = ;Set path that we want to upload from sFile = ;Set file to upload sConnection = ;Set Connection Directory entry dial FTP sConnection ;Make connection to FTP site iStatus = $FTPCONNECT while (iStatus == 1) ;Wait until connection is established yield iStatus = $FTPCONNECT endwhile pause 1 switch iStatus case 3 ;Connection attempt failed, perform error handling endcase case 2 ftp local chdir sPath ;Change local drive to directory to upload from ftp local copyfile sFile ;Copy file to FTP site while $FTPSTATUS ;Loop while file is being copied yield endwhile sendkey 0x74 ;Send F5 to Procomm Plus to refresh directory listing pause 10 ;Pause to let refresh occur ftp remote filelist sFileSpec ;Get list of files from FTP server while $FTPSTATUS yield endwhile fopen 0 sFileSpec READ TEXT ;Open list of files from FTP server while not feof 0 ;Loop while file still has data fgets 0 sData ;Get line of data from file if strfind sData sFile ;If filename matching that of uploaded file is found iFTPSuccess = 1 ;Set flag indicating file was uploaded successfully usermsg "File successfully transferred!" exitwhile ;Don't bother searching rest of file endif endwhile fclose 0 ;Close file delfile sFileSpec ;Delete local copy of FTP filelist endcase endswitch if iFTPSuccess == 0 ;File upload was not successful usermsg "Failed to upload file!" ; Perform additional error handling endif disconnect ;Disconnect from FTP server endproc