PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if (isset($_POST['upload'])) {
$u = TRUE;
} else {
$u = FALSE;
$message .= '<p>Please select a file to upload!</p>';
}
the following line after that is
if ($u) {
upload file;
}
i keep getting "please select a file to upload!" on my page, but $u apparently returns true becuase it's moving past the next if statement and uploading the file perfectly.
I'm wondering if i'm testing this for incorrectly...what would the correct syntax to check that a file (browse) form has been filled?
ok so the uploading the file anyway thing, i figured that out, but now it's getting stuck here... like it should (i guess)
my guess is that I'm not validating the file form correctly?
this form:
<form enctype = "multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset><legend>Enter your information in the form below:</legend>
<p><input type = " hidden" name = "MAX_FILE_SIZE" value = "2000000"/><b>select file:</b> <input type = "file" name = "upload" value = ""/></p>
</fieldset>