Ich versuche, den Namen der img-Datei aus HTML-Formular, aber Browser zeigt mir die folgende Fehlermeldung: Hinweis: Undefinierter Index: Bild in C: \ xampp \ htdocs \ login tutorial \ index.php on line 11Kann Image-Dateinamen nicht von POST-Objekt
Notice: Undefined index: Bild in C: \ xampp \ htdocs \ login index.php tutorial \ on line 12
Hier ist meine PHP-Code:
if(isset($_POST['submit'])){
$firstName = $_POST['fname'];
$lastName = $_POST['lname'];
$email = $_POST['email'];
$password = $_POST['password'];
$firstName = $_POST['fname'];
$passwordConfirm = $_POST['confPassword'];
$imageName = $_FILES['image']['name'];
$imageSize = $_FILES['image']['size'];
echo $firstName . "<br>" . $lastName . "<br>" . $email . "<br>" . $password . "<br>"
. $passwordConfirm . "<br>" . $imageName . "<br>" . $imageSize;
}
Hier ist mein HTML:
<form method="post" action="index.php" enctype="multipart/form-data ">
<label for="fname">First Name</label><br>
<input type="text" name="fname" id="fname"><br>
<label for="lname">Last Name</label><br>
<input type="text" name="lname" id="lname"><br>
<label for="email">Email</label><br>
<input type="text" name="email" id="email"><br>
<label for="password">Password</label><br>
<input type="password" name="password" id="password"><br>
<label for="confPassword">Confirm Password</label><br>
<input type="password" name="confPassword" id="confPassword"><br>
<input type="file" name="image"><br>
<input type="submit" name="submit">
</form>
UPDATE: Es sieht so aus, als hätte ich die Imagedatei nicht bekommen ... Warum?
dies wie folgt vor: http://www.w3schools.com/php/php_file_upload.asp –