Hmm.. this is strange..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.
I have a upload form in a html file and a corresponding PHP file that
shall take care of the information.
But I am doing something newbie error here..

What am I doing wrong? (The text is norwegian, but you still see and
understand the PHP code)

bildegalleri.html
---------------------
<!DOCTYPE html>
<html lang="no">
<head>
<meta charset="utf-8">
<title>Opplasting til Fotogalleri</title>
<link rel="stylesheet" href="standard.css" media="screen">
</head>
<body>
<h1>Opplasting til Fotogalleri</h1>
<form action="bildegalleri.php" method="post" enctype="multipart/form-data">
	<fieldset>
		<legend>Velg bilde for opplasting</legend>
		<label for="filbane">Filbane</label><br>
		<input type="file" id="filbane" name="filbane">
		<input type="submit" name="last_opp_fil" value="Last opp bildet">
	</fieldset>
</form>
</body>
</html>

bildegalleri.php
---------------------
<?php
if(!isset($_POST['last_opp_fil'])){
	header('Location: bildegalleri.html');
}
elseif(empty($_FILES['filbane'])){
	header('Location: bildegalleri.html');
} else {
?>
<!DOCTYPE html>
<html lang="no">
<head>
<meta charset="utf-8">
<title>Bildegalleri</title>
</head>
<body>
<h1>Bildegalleri</h1>
<?php
echo "OK";
}
?>
</body>
</html>

When I run this script, I always get "Ok". Even when the input file
field is empty.. Can someone tell me what I am doing wroing in this?

Thanks for you time and effort to help me out.

Karl

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux