Hello,
It has been a long time since my last post, but recently I was convinced to make a comeback. It was requested of me that I make a new FTP plugin for Dark Basic Professional.
String$ = ftpAbout();
Returns a string with information about the plugin. Currently it will only return my name. In the future it could return the version information
Integer = ftpConnect("Host", "Username", "Password")
Returns an integer with the status of the execution of the command. There are three possible status codes. If the command returns a zero, then it has successfully executed. If it returns a one, then it has failed to open a connection to the internet. If it returns a two, then it has failed to connect to the server because the information is probably wrong.
Integer = ftpDisconnect();
Returns a zero if it has succeeded in disconnecting from the server and the internet and a one if it fails. It is important to call this when you are done using FTP for the moment. If you do not disconnect and your server does not auto disconnect, you will experience very slow response times in your application.
Integer = ftpDownload("Remote File", "Local File")
Returns a zero if it successfully downloaded the file and a one if it fails. You must enter the path and filename in both the local and remote file fields. However, if you want to download a file from the current working directory there is no need to enter the path.
Integer = ftpUpload("Local File", "Remote File")
Returns a zero if it successfully uploaded the file and a one if it fails. You must enter the path and filename in both the local and remote file fields. However, if you want to upload a file into the current working directory there is no need to enter the path.
Integer = ftpDeleteFile("Filename")
Returns a zero if the file was found and deleted, otherwise it will return a one because it has either failed to find the file, or there was a problem deleting it.
Integer = ftpSetDirectory("Directory")
Returns a zero if the current working directory was changed successfully, otherwise a one is returned because it failed. In some cases depending on server, it is necessary to enter a leading slash. For example if you want to navigate to a folder called "Raboy" you may need to enter "/Raboy".
String$ = ftpGetCurrentDirectory();
Returns a string with the absolute path to the current working directory on the server. Use this whenever in doubt when setting the current directory
DWord = ftpFileSize("Filename")
Returns a dword with the file size of the specified filename. Don't let the dword scare you, as most of the time it can be treated like an integer.
Integer = ftpGoToRoot()
Returns a one if it has failed to navigate to the root of your FTP server and a zero if it has succeeded. The root of your FTP is directory "/".
Integer = ftpRenameFile("Start File", "End File")
Returns a one if the command has failed and a zero if it has succeeded.
Integer = ftpFileCount()
Returns the number of files and directories in the current working directory.
Integer = ftpCreateDirectory("Directory")
Returns a one if the command has failed to create a new directory in the current working directory and a zero if it has succeeded.
Integer = ftpDeleteDirectory("Directory")
Returns a one if the command has failed to delete a directory and a zero if it succeeded. Note that if your directory is not empty then it may not delete.
Integer = ftpIsConnected()
Returns a one if either the internet is disconnected or you have been disconnected from the server. A zero means you still have perfect connectivity.
STILL IN PROGRESS:
String$ = ftpFindFile("Filename", Index)
I have done just that and I have decided to make the source code freely available to everyone.
First I would like to recognize James Hill aka Arenas. He emailed me saying it would be great if I had made a new one. He is responsible for all my testing up to this point and he is responsible for making the keywords file for syntax highlighting.
I would like to point out that the DLL is not 100% bug free yet. For the most part it seems to be working fine, but some commands have a little bit of bugs left. I encourage you guys to let me know the bugs you find and or fix them in the source code.
The source was made with Visual C++ 2008 Professional Edition. If you are a student you can download it for free from the Microsoft DreamSpark website. I used the WinINet API that is built into Windows.
Any updates to the DLL or my other work can be found on my website.
Enjoy
Nic Raboy aka Lone Programmer