WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinInet
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

iFtpCmd APPE Example

 Keywords: iFtpCmd APPE Append Local Remote FTP file  

NOTICE to IE 7 users:
On a computer that has Windows Internet Explorer 7 installed, you may be unable to use an FTP application to upload a file to a remote server.
This problem occurs if the application is based on WinINet FTP functions.

CAUSE
This problem occurs because of an access violation that is caused by the underlying InternetWriteFile WinINet API function.

When you use an application that is based on WinINet FTP functions to upload a file to a remote server, the remote file is created by 
using the APPE FTP command. However, when the operating system tries to use the InternetWriteFile function to write the file, this access violation occurs.

It will require a Windows Hotfix. http://support.microsoft.com/default.aspx/kb/934376 
;Append a local file to an file on the FTP server.

localfile = 'c:\test\test.txt'        ; local file to append
ftpfile =  '/usr/home/test/test.txt'    ; ftp file to append to

AddExtender( "WWINT44I.DLL" )
tophandle = iBegin( 0, "", "" )
conhandle = iHostConnect( tophandle,"ftp.windowware.com", @FTPPASSIVE, "", "" )
If conhandle == 0
   Message( "ERROR" , "Unable to connect to host" )
   Exit
EndIf

cmdhandle=iFtpCmd( conhandle, 'APPE', ftpfile, @ASCII )
If cmdhandle==0
   err=iGetResponse()
   Message("iFtpCmd Error",err)
   iClose(cmdhandle)
   iClose(conhandle)
   iClose(tophandle)
   Exit
EndIf

iWriteData(cmdhandle, localfile)


iClose(cmdhandle)
iClose(conhandle)
iClose(tophandle)
Exit

Article ID:   W17616
Filename:   iFtpCmd APPE Example.txt
File Created: 2017:07:28:12:58:46
Last Updated: 2008:12:05:11:01:36