Tutorial 3: Creating a Basic FTP Client
In this tutorial we will create a basic FTP client application. The FTP client will consist of two NeoFM/FTP File Browsers - one for local files and one for remote files. When complete you will be able to use this application to drag and drop files from your computer to a remote FTP server.
We recommend that you start with a new VisualNEO Win publication.
1. Begin by using VisualNEO Win's Rectangle tool to define the location on the screen where you want the two NeoFM/FTP File Browsers to appear. To do this, select the Rectangle tool from VisualNEO Win's Tool Palette and draw two boxes on your publication. When your publication runs, the rectangles will be replaced by the two File Browsers. If needed, adjust the size of the Rectangle objects so that each takes up about 1/2 of the publication's workspace. Your screen should now look like this:
2. When our application first starts we need to connect to the local and remote file systems and open the two File Browsers. A good place to put initialization stuff like this is in the publication's StartUp script. To access the StartUp script, select App Properties > Actions from VisualNEO Win's App menu.
The App Properties screen will appear with the empty StartUp script displayed.
3. The first thing we want to do is add an action to connect to the local file system. To do this click the Insert Action button in the upper right corner of the StartUp script editor.
4. Locate and select the NeoFM/FTP category among the icons on the left side of the Action Selector.
Note: If you don't see an icon for NeoFM/FTP, then you have not properly installed the plug-in. See Install Plug-Ins in VisualNEO Win's Options menu.
5. After selecting the NeoFM/FTP icon, select fmConnectLocal from the right side of the screen. The following dialog box will appear:
6. The first parameter is the Connection ID, which is simply a name that we will use to refer to this connection in the future. It can be anything you like, but it's often easiest to use something short and descriptive. We'll use this ID later for other commands.
For this tutorial, enter Local for the Connection ID and C:\ for the Initial Path.
7. Click OK to add fmConnectLocal to the StartUp script.
8. Click the Insert Action button again and select the fmShowFileBrowser action.
9. Set the following fmShowFileBrowser action properties:
Note: If the first Rectangle object you created in step 1 has a name other than "Rectangle1" then substitute that name above.
10. Click OK to add fmShowFileBrowser to the StartUp script.
11. Next, we need to add an action to connect to the remote file system (FTP server). To do this click the Insert Action button in the upper right corner of the StartUp action editor and select the fmConnectRemote action. The following dialog box will appear:
12. Connecting to an FTP server is a little more complicated than connecting to a local file system. To make the connection you will need the following items:
- Access to the Internet.
- An FTP server. (This can be a web hosting account with FTP access.)
- The Host Name URL used to connect to your FTP server.
- Your FTP user name and password.
Once you have the above items, you can complete the fmConnectRemote action wizard form above.
The first parameter is the Connection ID, which is simply a name that we will use to refer to this connection in the future. As with the local connection, we will use this ID for other commands.
For this tutorial, enter Remote for the Connection ID.
The second parameter is the Host URL which is the Internet address of your FTP server. The third parameter contains your user name and password along with some other things that you can ignore for now.
13. Click OK to add fmConnectRemote to the StartUp script.
14. Click the Insert Action button once more and select the fmShowFileBrowser action.
15. Set the following fmShowFileBrowser action properties:
Note: If the second Rectangle object you created in step 1 has a name other than "Rectangle2" then substitute that name above. It's important that the local and remote File Browsers be assigned to different Rectangles or the application will not function properly.
16. Click OK to add fmShowFileBrowser to the StartUp script.
17. Your screen should now look like this:
18. Click the OK button at the bottom of the Book Properties screen to save the StartUp script.
19. Believe it or not, you now have a functioning FTP Client application. To test it, select Run (From Start) from VisualNEO Win's Book menu.
Note: Since our publication contains a StartUp action, you must use the Run (From Start) command.
20. Your screen should look something like this:
If everything went well, you should see the contents of your computer's hard drive on the left and the contents of your FTP server on the right. Files can be selected and dragged from one side to the other. However, the icons here represent real files, so be careful not to disturb anything important! Please read the warning below.
If you receive any error messages, close the publication, return to the StartUp action and make sure fmConnectRemote contains the correct host, user name and password.
WARNING: If you are operating in a corporate or organization environment, you must obtain permission from the server/website administrator or IT administrator before attempting to process files with NeoFM/FTP or any other tool. Please be extremely careful if you are experimenting with a live, mission critical website, server, workstation or stand-alone PC. It's certainly possible for someone who doesn't know what they are doing to accidentally delete important files or otherwise cause serious damage.
The sample "FTP Client.pub" included with NeoFM/FTP demonstrates how this simple tutorial can be expanded to create a fully functional FTP application.