Bonjour,
Voila j'ai une erreur sur cette ligne :
Undefined index: image in c:\program files\easyphp1-7\www\sitespip\ajout_com.php on line 71Code:$image=$_FILES['image']['tmp_name']; //Ligne71
d'ou cela peut il venir ?
Merci
Version imprimable
Bonjour,
Voila j'ai une erreur sur cette ligne :
Undefined index: image in c:\program files\easyphp1-7\www\sitespip\ajout_com.php on line 71Code:$image=$_FILES['image']['tmp_name']; //Ligne71
d'ou cela peut il venir ?
Merci
donne un peu plus de code parce que là c'est vague (et la ligne que tu as mis est correct)
Désolé voila :
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 <? include "connexion.php"; $image=$_FILES['image']['tmp_name']; $nom_sec = $_POST['nom_sec']; $nom_com = $_POST['nom_com']; $desc_com = $_POST['desc_com']; //copie du fichier .jpg $dossier_dest = '/im_article/'; if(move_uploaded_file($image,$dossier_dest.$nom_com.'.jpg')) echo "image conservée"; else echo "c'est raté"; $req1 = mysql_query("SELECT id_secteur FROM tb_secteur WHERE nom_secteur ='$nom_sec'") or die ("erreur req ".mysql_error()); $sql1 = mysql_fetch_array($req1); $nomsec=$sql1["id_secteur"]; if(!get_magic_quotes_gpc()) { $nom_com = addslashes($nom_com); $desc_com = addslashes($desc_com); } $sql = "INSERT INTO tb_communaute (nom_com, desc_com, id_secteur) VALUES('" . $nom_com . "','" . $desc_com . "','".$nomsec."')"; $res = mysql_query($sql) or ("Erreur dans ta requête".mysql_error()); // déconnection avec MySQL mysql_close(); ?>
essai de voir le nom de ton champ de selection de fichier. apparemment le nom image n'existe pas dans ton formulaie
ton formulaire d'envoie du fichier est bien correct ??
sinon les dossiers que tu mets son bien présent ??
parce que je vois pas ou est l'erreur ... :(
donne nous le code de ton formulaire d'envoi ;)
Voila mon formulaire d'envoiCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123<html> <head> <title>Administration du site </title> <link href="designcontact.css" rel="stylesheet" type="text/css" /> <link href="typographie.css" rel="stylesheet" type="text/css" /> </head> <body> <form method="post" name="form_ajout_com" action="ajout_com.php"> <table width="775" border="0" align="center" cellspacing="0" cellpadding="0"> <tr> <td height="123" valign="top"><img src="im_plan/banniere1.4.jpg" width="775" height="117"></td> </tr> <tr> <td height="52" valign="top"><table width="775" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="37" height="52"><img src="im_plan/hautgauche.jpg" width="37" height="52"></td> <td width="699" height="52" class="haut"><table width="699" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="223" align="left" valign="top" class="barrehaut"><br> <em class="milieu-texte"><strong>ADMINISTRATION DU SITE</strong></em></td> <td width="302" class="fond_date" id="date"><div align="left"> <td width="174" height="50" valign="middle" class="administrateur"><div align="right"><a href="ecrire/">Partie Privée<br> </a> </div> </td> </tr> </table> </td> <td width="39" height="52"><img src="im_plan/hautdroite.jpg" width="39" height="52"></td> </tr> </table> </tr> <tr> <td valign="top" width="775"><table width="775" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="21" colspan="3"> </td> </tr> <tr> <td width="18" class="milieugauche"> </td> <td width="746" class="milieu" id="textmilieuplan"><p class="milieu-texte">Choisir le secteur* : <select name="nom_sec"> <option selected value=""> ------ Séléction ------ <?php include ('connexion.php'); $sql = "SELECT nom_secteur FROM tb_secteur ORDER BY nom_secteur"; $res = mysql_query($sql); while($val=mysql_fetch_array($res)) { echo "<option>".$val["nom_secteur"]."</option>\n"; } ?> </select> </p> <input type="hidden" name="action" value="inserer" /> <p><span class="milieu-texte">Nom de la communauté* :</span> <input type="text" name="nom_com" /></p> <p><span class="milieu-texte">Description :</span> <input type="text" name="desc_com" /> </p> <p><span class="milieu-texte">Photo : </span> <input type="file" name="image" size="30"> </p> <p> <input name="btvalide" type="submit" value="Valider l'ajout d'une communauté"> </p> <p><a href="accueil_admin.html">Retour</a></p></td> <td width="11" class="milieudroit"> </td> </tr> <tr> <td height="25" colspan="3"> </td> </tr> </table> </tr> <tr> <td height="55" valign="top"><table width="775" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="37" height="55"><img src="im_plan/basgauche.jpg" width="37" height="55"></td> <td width="699" height="55" class="bas" id="liensbas"> <div align="center"><a href="#URL_SITE_SPIP">Accueil</a> <a href="plan.php3"> | Plan du site</a> <a href="contacts.html"> | Contacts</a> <a href="liens.html"> | Les Liens</a> <a href=""> | </a></div></td> <td width="39" height="55"><img src="im_plan/basgauche.jpg" width="37" height="52"></td> </tr> </table> </td> </tr> </table> </form> </body> </html>
Bonjour,
Reecris ta balise form :
<form method="post" name="form_ajout_com" action="ajout_com.php" ENCTYPE="multipart/form-data">
Ca devrait mieux se passer.
Bye,
Sohnic
Il m'affiche ceci maitenant :
:?:Citation:
Warning: move_uploaded_file(/im_article/Coeur de ville.jpg): failed to open stream: No such file or directory in c:\program files\easyphp1-7\www\sitespip\ajout_com.php on line 81
Warning: move_uploaded_file(): Unable to move 'C:\Program Files\EasyPHP1-7\tmp\phpF5.tmp' to '/im_article/Coeur de ville.jpg' in c:\program files\easyphp1-7\www\sitespip\ajout_com.php on line 81
c'est raté
dossier existant ??? bon chemin d'accet ??Citation:
No such file or directory
Ca c'est parcequ'avec le chemin que tu as indiqué il cherche a placer le fichier a la racine... de ton disque. Je suppose que c:\im_article\ n'existe pas..
Il te suffit de supprimer le premier / dans ton move pour faire du chemin relatif.
S.
Le chemin d'access est spécifier ici :
Je choisi la photo que je désire et apres cette photo elle est stoker ou comment ca fonctionnne je mis perds.Code:$dossier_dest = '/im_article/';
Quelqu'un pourrai m'expliquer comment cela fontionne clairement.
Merci sohnic ! tu avais raison cela fonctionne maitenant ! Merci :wink: