Re: Hmm.. this is strange..
| From: | Serge Fonville | Date: | Tue, 24 Apr 2012 14:48:57 +0000 |
| Subject: | Re: Hmm.. this is strange.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317664@lists.php.net to get a copy of this message | ||
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@gmail.com>:
> 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
>