; English forum: http://purebasic.myforums.net/viewtopic.php?t=8971&highlight= ; Author: Paul ; Date: 02. January 2004 ; Here is some simple code I wrote for FTP Access... ; Basically wrappers for API commands but maybe the syntax makes a little more sense for beginners Procedure.l FTPInit() ProcedureReturn InternetOpen_("FTP",1,"","",0) EndProcedure Procedure.l FTPConnect(hInternet,Server.s,User.s,Password.s,Port.l) ProcedureReturn InternetConnect_(hInternet,Server,Port,User,Password,1,0,0) EndProcedure Procedure.l FTPDir(hConnect.l) hFind=FtpFindFirstFile_(hConnect,"*.*",@FTPFile.WIN32_FIND_DATA,0,0) If hFind Find=1 Debug PeekS(@FTPFile\cFileName) While Find Find=InternetFindNextFile_(hFind,@FTPFile) If Find Debug PeekS(@FTPFile\cFileName) EndIf Wend EndIf EndProcedure Procedure.l FTPSetDir(hConnect.l,Dir.s) ProcedureReturn FtpSetCurrentDirectory_(hConnect,Dir) EndProcedure Procedure.l FTPCreateDir(hConnect.l,Dir.s) ProcedureReturn FTPCreateDirectory_(hConnect,Dir) EndProcedure Procedure.l FTPDownload(hConnect.l,Source.s,Dest.s) ProcedureReturn FTPGetFile_(hConnect,Source,Dest,0,0,0,0) EndProcedure Procedure.l FTPUpload(hConnect.l,Source.s,Dest.s) ProcedureReturn FTPPutFile_(hConnect,Source,Dest,0,0) EndProcedure Procedure.l FTPClose(hInternet.l) ProcedureReturn InternetCloseHandle_(hInternet) EndProcedure ;-------------------- hInternet=FTPInit() If hInternet hConnect=FTPConnect(hInternet,"ftp.reelmediaproductions.com","guest","guest",21) If hConnect FTPSetDir(hConnect,"test/") FTPDir(hConnect) FTPDownload(hConnect,"hello.txt","C:\download.txt") FTPUpload(hConnect,"C:\Download.txt","download.txt") FTPClose(hInternet) EndIf EndIf End ; ExecutableFormat=Windows ; FirstLine=1 ; EOF