We've all worked with FTP clients such as WS_FTP, CuteFTP, etc. FTP, or File Transfer Protocol, is the protocol that handles the copying of a file from one computer to another computer, either on the local or a remote network.
FTP is a standard protocol, and as such has its own RFC (Request For Comments) file, which is located at http://www.faqs.org/rfcs/rfc959.html. If you take a look at the 61 page FTP RFC, then you might find it a bit hard to learn all of the commands that you need to talk to a server using raw FTP commands. Luckily for us, PHP abstracts the raw FTP commands and provides functionality that allows us to easily connect to an FTP server, send files, retrieve and delete files, etc.
In this article we’re going to examine PHP's set of functions that allow us to interface with a remote server using the FTP protocol. We will learn how to connect to an FTP server, how to send and receive files, and also how to traverse directories amongst other things. We will top it all off by building a useable web based FTP application.
The FTP extension for PHP comes as standard with all Windows binary versions of PHP, however if you've got PHP installed on a Linux/Unix server then you’ll need to make sure that it was compiled with PHP support (--enable-ftp). To do this, just create a PHP script containing <?php echo phpinfo(); ?> and run it through your browser. Look for the FTP section and make sure FTP support is enabled.