Hello,

I need some help with some php script for file management. So far, the code can upload up to 3 files at once and it works fine. However, I would like to have the ability to delete files from the directory that they are uploaded to. I would appreciate some help.

Here's the code I have so far:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<title>Upload a File</title>
</head>
<body>
<?php 


ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

if (isset ($_POST['submit'])) { 

	
	if (move_uploaded_file ($_FILES['file1']['tmp_name'], "files/{$_FILES['file1']['name']}")) {
	
		print '<p>Your file has been uploaded.</p>';
		
	} else { 
	
		print '<p>Your file could not be uploaded because: <b>';
		
		
		switch ($_FILES['file1']['error']) {
			case 1:
				print 'The file exceeds the upload_max_filesize setting in php.ini';
				break;
			case 2:
				print 'The file exceeds the MAX_FILE_SIZE setting in the HTML form';
				break;
			case 3:
				print 'The file was only partially uploaded';
				break;
			case 4:
				print 'No file was uploaded';
				break;
		}
		print '</b>.</p>';
	}
	
} 
if (isset ($_POST['submit'])) { 

	
	if (move_uploaded_file ($_FILES['file2']['tmp_name'], "files/{$_FILES['file2']['name']}")) {
	
		print '<p>Your file has been uploaded.</p>';
		
	} else { 
	
		print '<p>Your file could not be uploaded because: <b>';
		
		
		switch ($_FILES['file2']['error']) {
			case 1:
				print 'The file exceeds the upload_max_filesize setting in php.ini';
				break;
			case 2:
				print 'The file exceeds the MAX_FILE_SIZE setting in the HTML form';
				break;
			case 3:
				print 'The file was only partially uploaded';
				break;
			case 4:
				print 'No file was uploaded';
				break;
		}
		print '</b>.</p>';
	}
	
} 
if (isset ($_POST['submit'])) { 

	
	if (move_uploaded_file ($_FILES['file3']['tmp_name'], "files/{$_FILES['file3']['name']}")) {
	
		print '<p>Your file has been uploaded.</p>';
		
	} else { 
	
		print '<p>Your file could not be uploaded because: <b>';
		
		
		switch ($_FILES['file3']['error']) {
			case 1:
				print 'The file exceeds the upload_max_filesize setting in php.ini';
				break;
			case 2:
				print 'The file exceeds the MAX_FILE_SIZE setting in the HTML form';
				break;
			case 3:
				print 'The file was only partially uploaded';
				break;
			case 4:
				print 'No file was uploaded';
				break;
		}
		print '</b>.</p>';
	}
	
} 
?>

<form action="index.php" enctype="multipart/form-data" method="post">
<center>
<p>Upload a file using this form: <br /><br />
<input type="hidden" name="MAX_FILE_SIZE" value="5242880" />
<input type="file" name="file1" /><br /><br />
<input type="file" name="file2" /><br /><br />
<input type="file" name="file3" /><br /><br />
<input type="submit" name="submit" value="Upload This File" />
<br><br>
<a href="files/">View Files</a>
</p>
</center>
</form>
</body>
</html>