cannot read form variable

Hello, do you have any idea to be able to read the send variable of the form?
Altough I browse a file, it still does not show anything in the echo marked with asterisks below.thks in advance

<!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>Untitled Document</title>
</head>

<body>
<?PHP
if ($_POST['send']) {
	echo "upfile = ".$_POST['upfile'];// ********* I don't know why this line does not print the name of the //choosen upfile. It's
		                              // as if the variable upfile of the form could not be readed. Moreover, the following if conditions 
									  //obviously cannot work until I solve this issue.
	if ($_POST['upfile'] != "none" AND $_POST['upfile_size'] != 0){
		echo "Name: ".$_POST['upfile_name']."<BR>n";
		echo "Size: ".$_POST['upfile_size']." <BR>n";
		echo "Type: ".$_POST['upfile_type']." <BR>n";
		
		// for Windows
		if (! copy ($_POST['file'], "C:\TEMP\".$_POST['upfile_name'])) {
			echo "<h2>File could not be copied</h2>n";
			}
		
		/* for Linux/Unix 
		if (! copy ($_POST['file'], "/tmp/".$_POST['file_name'])) {
			echo "<h2>File could not be copied</h2>n";
			}
		} */
		}
	elseif (($_POST['upfile'] != "none") AND ($_POST['upfile_size'] == 0)) {
			echo "<h2>File size exceded exceded</h2>n";
			}
	else {
			echo "<h2>You haven't choose a new file to upload</h2>n";
		}
	echo "<HR>n";
	}
?>
<FORM ENCTYPE="multipart/form-data" ACTION="<?php echo $PHP_SELF ?>" METHOD="post">
	<INPUT type="hidden" name="MAX_FILE_SIZE" value="100000">
		<p><b>File to upload<b><br>
		Example
	<INPUT type="file" name="upfile" size="35"></p>
	<p><INPUT type="submit" name="send" value="Accept"></p>
</FORM>
</body>
</html>

ADMIN Edit: Added CODE tags for readability. Please see http://phphelp.com/guidelines.php for posting guidelines.

$_FILE[‘upfile’] is an ARRAY that contains the data you are looking for and not $_POST[‘upfile’]

This array will contain the needed data such as
name, type, tmp_name, error, and size
which can then be accessed using the following:

$_FILE[‘upfile’][‘name’]
$_FILE[‘upfile’][‘type’]
$_FILE[‘upfile’][‘tmp_name’]
$_FILE[‘upfile’][’'error]
$_FILE[‘upfile’][‘size’]

Additionally you need to use the “tmp_name” to copy it from the Temporary location to it’s permanent location that you desire.

More information can be found on this at http://us.php.net/manual/en/features.file-upload.php

Sponsor our Newsletter | Privacy Policy | Terms of Service