Forums

PHP

This topic is locked

form file field NOT WORKING

Posted 20 Mar 2007 15:51:22
1
has voted
20 Mar 2007 15:51:22 Mauro BBianc posted:
Guys,

can anyone tell me why the file field does not show up in the destination page as a form variable, as all the other fields I have in the same form?

I have one page named myform.php containing:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="myserv.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<p>
<input name="myname" type="text" id="myname">
</p>
<p>
<input name="myfilename" type="file" id="myfilename">
</p>
<p>
<input name="submit" type="submit" id="submit" value="create">
</p>
</form>
</body>
</html>
-----------------
an one page named myserv.php containing
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>myname = <?php echo $_POST['myname']; ?></p>
<p>myfilename = <?php echo $_POST['myfilename']; ?> </p>
<p> </p>
</body>
</html>
------------
myserv.php yelds the following:

myname = test

myfilename =
Notice: Undefined index: myfilename in c:\programmi\easyphp1-8\www\prodotti\myserv.php on line 9

-----

Isn't the value of the file field supposed to appear as a normal posted variable named myfilename, just as all other fields do?

Please help and explain.
Be patient, I am new to PHP and web programming.
:-] Thank you



Replies

Replied 20 Mar 2007 16:37:14
20 Mar 2007 16:37:14 Mauro BBianc replied:
OK, understood.
The file is actually uploaded

Reply to this topic