Here I try to check if the input file is empty or not. But still it did not work. I receive OK even when the input file field is empty.. <?php if(!isset($_POST['last_opp_fil'])){ header('Location: bildegalleri.html'); } else { $bildefil = $_FILES['filbane']; if(empty($bildefil)){ 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> Den 16:48 24. april 2012 skrev Serge Fonville <serge.fonville@xxxxxxxxx> følgende: > Hi, > > Instead of just checking if the variable is not set, additionally > check if it is empty > > Kind regards/met vriendelijke groet, > > Serge Fonville > > http://www.sergefonville.nl > > Convince Google!! > They need to add GAL support on Android (star to agree) > http://code.google.com/p/android/issues/detail?id=4602 > > > 2012/4/24 Karl-Arne Gjersøyen <karlarneg@xxxxxxxxx>: >> 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 >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php