Delete Files on The Server

New Articles

Is FTP secure?

PHP File upload progress bar.

The case of the missing errors.

Delete Files

In part III of this series (Prune and Graft) you learnt how to delete a folder with the RMD command. This command cannot be used on files. So in this penaltimate page in our series we will implement support for deleting files with the DELE command.

Just because a file exists does not mean that it can be deleted. You need to be the owner of the file or have sufficient permissions. And of course you cannot use the DELE command on folders.

	function dele($path)
		$this->sock_write("DELE $path");
		return $this->check_reply("250");

And that's all there really is to it. We now have a web based FTP client build in PHP with the functionality that you find in commonly available commercial software. The fact that our client does not have to be muliti threaded certainly helps!. We didn't have to look into the complexities of working with a Graphical User Interface either. But our client can in no means be treated as trivial since it provides a solution to the common problem of using ftp through firewalls

Let's get on the the last step and we will look at another demo as well. Logo

FTP Applet

  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