Création d'un petit site Web qui devrait afficher quelques émissions de télévision différentes. J'ai une page qui devrait permettre à l'utilisateur d'entrer un nouveau nom de programme de télévision et une image du programme de télévision.Indéfini indécis pourquoi
Pour une raison im obtenir l'erreur d'index non défini sur les lignes: 41, 44, 45 et 52. code est ci-dessous:
<form action="upload.php" method="POST" enctype="multipart/form-data">
Programme Title: <input type="text" name="title"> </br>
Select photo to upload:<input type="file" name="photo" id="photo"> <br/>
<input type="submit" value="Upload" name="submit">
</form>
<?php
//This is the directory where images will be saved
$target = "images/";
$target = $target . basename($_FILES['photo']['name']); --- ERROR line 41
//This gets all the other information from the form
$title=$_POST['name']; --- ERROR line 44
$pic=($_FILES[' ']['name']); --- ERROR line 45
//Writes the information to the database
mysqli_query($mysqli, "INSERT INTO programmes VALUES ('', '$title', '', '$pic')") ;
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) --- ERROR line 52
{
//Tells you if its all ok
echo "The file ". basename($_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
}
else {
//Gives and error if its not
echo "Sorry, there was a problem uploading your file.";
}
?>
msg d'erreur:
Undefined index: photo en C : \ wamp \ www \ sky_coding \ upload.php en ligne 45, 49 et 55 index défini: document dans C: \ wamp \ www \ sky_coding \ upload.php sur la ligne 48
S'il vous plaît aider im confus et je ne sais pas pourquoi je reçois cette erreur
toute information sera utile merci!
S'il vous plaît marquer la lignes. –
@NiranjanNRaju Comment marquer les lignes? – Tman
juste écrire une ligne là comme «ligne d'erreur» dans les commentaires –