Problème d'affichage d'image

Résolu
Tomas -  
 Tomas -
Bonjour, je m’appelle Tomas et j'ai fait un contact form en php ou le mec peut envoyer son mot de passe ..etc et une image au bol de lui mais l'image ne veut pas marcher
<?php

$nom = filter_input(INPUT_POST, "nom");

$email = filter_input(INPUT_POST, "email");

$motdepasse = filter_input(INPUT_POST, "motdepasse");

$genre = filter_input(INPUT_POST, "genre");

$image = filter_input(INPUT_POST, "image");

?>
<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>Acceuil</title>
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="css/php.css" />
    <script src="script/Index.js" type="text/javascript"></script>
    <style>
            

header 
{
    text-align: center;
    background-color: black;
    height: 50px;
    line-height: 50px;
    color: white;
}


.information {
text-align: center;
height: 10px;
line-height: 30px;
}


    </style>
<body>

<header class = "container-fluid">
    <div class="container">
         <h2>Information de la candidature </h2>
        
</header>


    <section class ="information">
   
    
   
  
    <div class="row">
            <article class="col-nd-12 col-lg-12 col-xs-12 col-sn-12">
               <p>
                   <?php
                   
$nomOrigine = $_FILES['image']['name'];
$elementsChemin = pathinfo($nomOrigine);
$extensionFichier = $elementsChemin['extension'];
$extensionsAutorisees = array("jpeg", "jpg", "gif" ,"png");
if (!(in_array($extensionFichier, $extensionsAutorisees))) {
echo "Le fichier n'a pas l'extension attendue";
} else {    
// Copie dans le repertoire du script avec un nom
// incluant l'heure a la seconde pres 
$repertoireDestination = dirname(__FILE__)."/image/";
echo $repertoireDestination;
$nomDestination = "Portrait".date("YmdHis").".".$extensionFichier;

if (move_uploaded_file($_FILES["image"]["tmp_name"], 
$repertoireDestination.$nomDestination)) {
echo "Le fichier temporaire ".$_FILES["image"]["tmp_name"].
" a été déplacé vers ".$repertoireDestination.$nomDestination;
} else {
echo "Le fichier n'a pas été uploadé (trop gros ?) ou ".
"Le déplacement du fichier temporaire a échoué".
" vérifiez l'existence du répertoire ".$repertoireDestination;
}
}
echo "<br>";

echo "<img src ='image'/'.$nomDestination'/>";
echo  "<br>Votre Nom complet: $nom";
echo  "<br>Votre Email: $email";
echo  "<br>Votre Mot De Passe: $motdepasse";
echo  "<br>Votre sexe: $genre";

                   ?>
               </p>
            </article>
           
        </div>
               
        <a href = "formulaire.html">Retourner vers la page de candidature</a>
              
            </article>


    </section>


</body>
</html>


EDIT : Ajout des BALISES DE CODE

3 réponses

  1. jordane45 Messages postés 30427 Date d'inscription   Statut Modérateur Dernière intervention   4 832
     
    Bonjour,

    Déjà, à l'avenir, lorsque tu posteras du code sur le forum, merci d'utiliser les BALISES DE CODE.
    explications disponibles ici :
    https://codes-sources.commentcamarche.net/faq/11288-les-balises-de-code

    Ensuite
    echo "<img src ='image'/'.$nomDestination'/>";
    

    A remplacer par
    echo "<img src ='image/$nomDestination'/>";
    

    ou par
    echo "<img src ='image/".$nomDestination ."'/>";
    


    Je t'invite également à prendre connaissance (et à appliquer) les conseils donnés ici pour tes prochains codes :
    https://forums.commentcamarche.net/forum/affich-37584947-php-gestion-des-erreurs-debogage-et-ecriture-du-code
    .
    1
  2. Tomas
     
    L'image ne s'affiche pas

    C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\ProjetJavascript/image/Le fichier temporaire C:\Users\tomas\AppData\Local\Temp\php6430.tmp a été déplacé vers C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\ProjetJavascript/image/Portrait20200508132303.png

    Votre Nom complet: Tomas
    Votre Email: ***@***
    Votre Mot De Passe: MotDePasse
    Votre sexe: Male

    Retourner vers la page de candidature
    0
  3. Tomas
     
    Merci bcp de ton aide Jordane

    Ton code marche parfaitement

    Au revoir et à bientôt
    0