Web Based FTP with Raw Sockets and PHP

Articles

a quick look at FTP commands

Swing Slow paint problem.

The case of the missing errors.

Architecture

As mentioned at the start of the first part of this article, our web based FTP software will be built using raw sockets. We do not rely on the FTP functions built into PHP.

You might also find it worth your time to read the related article on using telnet as a substitute for FTP, and the backgrounder on security issues.

Before we get down to business let's look at how web based File Transfer Protocol client differs from a standalone clients. (skip ahead if you would rather get into the coding instead of reading this commentary.)


Web based Based vs Stand Alone FTP clients

As the above diagram shows, with web based FTP there isn't a direct connection between the end user's computer and the server. This is very usefull if you are working behind a firewall. Some idiotic ISPs use firewalls to block all ports expect 80, which is used by HTTP. The familiar web based email systems also have a similar architecture.

A user trapped behind such a firewall cannot make use of the File Transfer Protocol or many of the other usefull protocols that we take for granted. Web based clients work through an intermediate webserver, which allows users behind such firewalls to make use the File Transfer Protocol.

The major drawback for these systems is the web server that acts as intemediary is burning up bandwidth at twice the rate. Because HTTP is stateless we need to make use of cookies or a similar mechanism to store user information between requests.

There are a small number of FTP applets (including the one by Rad Inks), although are are also called web based clients they do not fit the description given above. Their behaviour is closer to standard desktop software.

Now let's get back to the coding



SourceForge.net Logo

FTP Applet

Navigation
  Part 1   Introduction ,   Data Connection ,   Directory List ,   demo
  Part 2   Architecture ,   Downloading ,   Demo ,   Sessions
  Part 3   CWD ,   CDUP ,   Where am I? ,   Prune and Graft
  Part 4   Upload ,   Rename ,   Delete,   No operation