KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to transfer 4D databases over FTP
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: June 6, 2007
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

It is often useful to use FTP to transfer a 4D database. This tip will cover how to do it using either platform for users not familiar with FTP, as well as some specific issues for 4D databases.

Issues for 4D databases:

It is always important to archive your 4D database files (using winzip, stuffit, winRAR, or similar software) before uploading them to an FTP site. If the files are not archived then it is possible to lose the resources during the transfer. This is true of network transfers from one machine to another as well as FTP transfers. This problem is much less pronounced with 4D 2004 when compared to previous versions because most 2004 databases do not have resource forks, but it is still safer to archive the database files before transferring them.

Windows:



Open a Windows Explorer window. This can be done simply by double-clicking your My Computer icon or My Documents. Windows Explorer is also accessible through the Start Menu: All Programs/Accessories/Windows Explorer.

Once this window is open simply type a string made up of the FTP account username, password, and server for your FTP account. This is the format for that string:

ftp://username:password@serveraddress


For example:
ftp://4DTechCustomer:Mypassword@myftpsite.4d.com


A screenshot of that example:



On a Windows machine this should be all you have to do, as at this point you can drag and drop a compressed 4D database into the Windows Explorer window or out of it.

MacOS:



We'll go over two different ways to transfer files with FTP on the Mac.

1. Use the built-in FTP client:



Launch Applications:Utilities:Terminal.app

Once inside Terminal use the "cd "command to navigate to the folder wherein the file you would like to upload is stored, or to which you would like to download a file. For example:
cd Desktop


To go to the Desktop. One way to get a list of current possible locations is using the "ls" command. Here is a screenshot of the use of that command and the "cd" command:



Once you are in the desired directory you must connect to the FTP server. To do that type the command "ftp (server name)". In (server name) input the server name, so from the last example the command would be "ftp myftpsite.4d.com". After this you will be prompted for a Name (user name to login), and Password.

Once you are in the FTP server the prompt in Terminal will read "ftp>" and at this point you can use the "put" and "get" commands to upload or download files, respectively. For example "put mydatabase.sit" will put mydatabase.sit into the current folder on the FTP site and "get mydatabase.sit" will copy it from the FTP site to your Desktop (if that is the current local directory).

Before you send or receive 4D databases using the Terminal it is important to use the "bin" command to change the transfer method from text to binary. All you need to do is type "bin" at the ftp> prompt and the mode will be changed.

That concludes how to upload and download files on the Terminal on the Mac OS.

2. Use 4D's demo database FTP Client



You can download this at:

http://4d.com/us/support/resources/exampleapplications.html

The database is under the heading "FTP Client".

Once you have unstuffed this database all you need to do is run it in the latest version of 4D and go to the FTP Client screen at startup of the database, click the FTP Client button, and input your FTP information. Repeating a previous example from this tech tip you would input in the fields as follows:

FTP Domain: myftpsite.4d.com
Username: 4DTechCustomer
Password: Mypassword

And click connect. Here's a screen shot:



Once you're connected you can use the Get and Put buttons to transfer files. This FTP Client makes transfers very easy.

There are of course many other freeware and payware FTP clients available for MacOS and Windows. Feel free to experiment!

Commented by Jesse Pina on March 31, 2009 at 4:29 PM
When uploading a file using the Terminal on Mac OS, instead of typing in the path to the file, you can simply drag-and-drop the file onto the terminal and it will automatically paste the path to the file.
Commented by Jesse Pina on February 13, 2009 at 1:49 PM
When uploading on Mac OS, do not forget to transfer in binary mode. This is essential when uploading a 4D database.