<?php /*ceci est upload php*/ /*transfert du fichier client vers le repertoire du serveur*/ //on vérifies que le champ est bien rempli: if(!empty($_FILES["fichier_choisi"]["name"])) { //nom du fichier choisi: $nomFichier = $_FILES["fichier_choisi"]["name"] ; //nom temporaire sur le serveur: $nomTemporaire = $_FILES["fichier_choisi"]["tmp_name"] ; //type du fichier choisi: $typeFichier = $_FILES["fichier_choisi"]["type"] ; //poids en octets du fichier choisit: $poidsFichier = $_FILES["fichier_choisi"]["size"] ; //code de l'erreur si jamais il y en a une: $codeErreur = $_FILES["fichier_choisi"]["error"] ; //chemin qui mène au dossier qui va contenir les fichiers uplaod: $chemin = "./upload_fichier/" ; if(copy($nomTemporaire, $fichier_choisi = $chemin.$nomFichier)) echo(" l'upload a réussi : <hr >") ; else echo(" l'upload a échoué") ; }//fin if else { echo("Vous n'avez pas choisit de fichier!! ") ; echo("Retour") ; }//fin else /*partie sql insertion du chemin*/ if (isset($_POST["bouton_submit"])) { //$_POST["fichier_choisi"]=""; //$statut = $_POST['fichier_choisi']; /*a personnaliser ton serveur ta base ...*/ $db = mysql_connect('localhost', 'root', '') or die(mysql_error()); mysql_select_db('a',$db) or die(mysql_error()); /*on insere le chemin vers le ficihier uploade*/ // on fait l'INSERT dans la base de données $sql= "INSERT INTO renseigner (fichier_choisi) VALUES ('$fichier_choisi')"; $result = mysql_query($sql) or die(mysql_error()); if (!$result) { die('linsertion n a pas réussie !!! : ' . mysql_error()); } //header("Location:renseignement.php?add=ok"); // redirection si création réussie } else { // form pas submit } ?>
<!--choix_fichier.html--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Document sans titre</title> </head> <form action="./upload.php" method="post" enctype="multipart/form-data" name="formulaire_envoi_fichier" id="formulaire_envoi_fichier"> </form> </html>
<?php $_POST["fichier_choisi"]= ""; $nom1=trim($_POST["fichier_choisi"]); $color=array('#333333','#999999'); $i=0; // Connexion à la BDD mysql_connect("localhost","root","") or die("erreur de connexion"); // Sélection de la base de données mysql_select_db("DirectVictime") or die("Erreur de selection de la BD"); /*faut securiser*/ // on crée la requête SQL $sql = "SELECT fichier_choisi FROM renseigner WHERE id='5'"; // on envoie la requête $req = mysql_query($sql) or die('Erreur SQL ! '.$sql.' '.mysql_error()); $res = mysql_num_rows($req); // 4 ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Document sans titre</title> <style type="text/css"> <!-- .Style3 {color: #FFFFFF} .Style6 { color: #0000FF; font-style: italic; font-weight: bold; } --> </style> </head> >>> IMAGE DE LA VICTIMES DE GUERRE EN COTE D'IVOIRE <<< Accueil | ---- PHOTO | <?php while ($liste_etu =mysql_fetch_assoc($req)) { $j=$i%2; ?> ---- <?php echo $liste_etu['fichier_choisi'] ?>, <?php } ?> </html>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question<?php $_POST["fichier_choisi"]= ""; $nom1=trim($_POST["fichier_choisi"]); $color=array('#333333','#999999'); $i=0; // Connexion à la BDD mysql_connect("localhost","root","") or die("erreur de connexion"); // Sélection de la base de données mysql_select_db("DirectVictime") or die("Erreur de selection de la BD"); /*faut securiser*/ // on crée la requête SQL $sql = "SELECT fichier_choisi FROM renseigner WHERE id='5'"; // on envoie la requête $req = mysql_query($sql) or die('Erreur SQL ! '.$sql.' '.mysql_error()); $res = mysql_num_rows($req); // 4 ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Document sans titre</title> <style type="text/css"> <!-- .Style3 {color: #FFFFFF} .Style6 { color: #0000FF; font-style: italic; font-weight: bold; } --> </style> </head> >>> IMAGE DE LA VICTIMES DE GUERRE EN COTE D'IVOIRE <<< Accueil | ---- PHOTO | <?php while ($liste_etu =mysql_fetch_assoc($req)) { $j=$i%2; ?> ---- <?php echo $liste_etu['fichier_choisi'] ?>, <?php } ?> </html>
<?php $_POST["fichier_choisi"]= ""; // $nom1=trim($_POST["fichier_choisi"]); $color=array('#333333','#999999'); $i=0; // Connexion à la BDD mysql_connect("localhost","root","") or die("erreur de connexion"); // Sélection de la base de données mysql_select_db("DirectVictime") or die("Erreur de selection de la BD"); /*faut securiser*/ // on crée la requête SQL $sql = "SELECT fichier_choisi FROM renseigner WHERE id='5'"; // on envoie la requête $req = mysql_query($sql) or die('Erreur SQL ! '.$sql.' '.mysql_error()); $res = mysql_num_rows($req); if (!$res) { $message = 'Requête invalide : ' . mysql_error() . "\n"; $message .= 'Requête complète : ' . $query; die($message); } // 4 ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Document sans titre</title> <style type="text/css"> <!-- .Style3 {color: #FFFFFF} .Style6 { color: #0000FF; font-style: italic; font-weight: bold; } --> </style> </head> >>> IMAGE DE LA VICTIMES DE GUERRE EN COTE D'IVOIRE <<< Accueil | ---- PHOTO | <?php while ($liste_etu =mysql_fetch_assoc($req)) { $j=$i%2; ?> ---- <?php //echo $liste_etu['fichier_choisi'] echo ""; ?>, <?php } ?> </html>