Posted by Daniele on 02/15/07 13:18
Rik wrote:
> On Thu, 15 Feb 2007 13:52:40 +0100, jodleren <sonnich@hot.ee> wrote:
>>> > <form method=post name='myform' action='the_file_itself'>
>>>
>>> <form enctype="multipart/form-data" method="post" action="/">
>>>
>>> Enctype is important.
>>
>> Thanks. I asume that it does not stop me from checking other actions
>> in my form?
>> I cannot test yet :-)
>
> Any other normal postvalue is just handled fine indeed.
> --Rik Wasmus
try this
<!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>
<?
if (isSet($_POST['add'])) {
$uploaddir = '.';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
echo '<pre>';
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
echo "file upload in " . $_FILES['file']['tmp_name'] ."\n";
}
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
echo "File was successfully uploaded.\n";
} else {
echo "File was NOT successfully uploaded.\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
}
?>
<body>
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post"
enctype="multipart/form-data">
<p>Pictures:
<input type="file" name="file" />
<input name="add" type="submit" id="add" value="add" />
</p>
</form>
</body>
</html>
[Back to original message]
|