Download and upload by FTP

The FTP interface for Scriptol and PHP makes it possible a full management of the contents of a Web site by the ftp protocol. Mainly to upload files on the site or to download them, but also to create or remove directories, changing permissions, renaming, obtaining information about files, etc.

How it works

The ftp access starts with a connection to the Web site on the server, according to its address of the form: ftp.domainename.tld.

int x = ftp_connect ("")

This function requires a small delay, and returns a number which will be used for all further ftp functions.
Thus, to finish the session one will do:


Once connected, one send a login and a password:

boolean result = ftp_login (x, "login", "password")

If the user is recognized, the function returns true and one can now execute the desired operations.
For sending a file to the server:

ftp_put (x, remotepath, localname, mode)

For downloading a file from the server:

ftp_get (x, remotepath, localname, mode)

The mode is FTP_ASCII for a textual file and FTP_BINARY for a binary file, an image for example.

Source codes