upload image !

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : upload image !

par StarT » 05 nov. 2005, 20:29

Je ne sais plus comment te remercier Truc ça marche très bien !!!!! Merci beaucoup :D

par Truc » 05 nov. 2005, 16:17

alors j'ai repris ton code pour faire des essais et ça marche (je récupère les données du champ texte et l'image) mais il faut enlever les balises <form> et </form> que tu as placées au niveau du champ text.

<table width="100%" border="0">
<form>
...

<textarea name="description" cols="40" rows="4" class="txt1" id="description" onKeyPress="controle()"></textarea>

...

</form>
</table>
ca te fait 2 formulaires dans la page avec un bouton (image) pour valider.

par Truc » 05 nov. 2005, 03:49

Merci, de meme :D
meme si c'est plustot au lit a cette heure ci :lol:

par StarT » 05 nov. 2005, 03:45

Merci beaucoup pour ton aide Truc ! Bonne soirée :wink:

par Truc » 05 nov. 2005, 03:43

Je vois vraiment pas d'ou peut provenir l'erreur, je ferai des tests demain (enfin tout a l'heure :wink: ) et si je trouve quelque chose je reviendrai :wink:

par StarT » 05 nov. 2005, 03:31

je reccupere toujours que le texte saisi dans le textarea !

par Truc » 05 nov. 2005, 03:27

Euh oui effectivement rien a voir :lol:

peut etre un conflit de javascript, limite le code juste a ceci:
function controle()
{
var texte = document.getElementById("description").value;
document.getElementById("description").value= texte.substring(0,150);
}
et verifi si dasn ce cas tu récupère le contenu du cahmp texte et l'upload

par StarT » 05 nov. 2005, 03:22

Non c'est pas ça C l'image qui ne se telecharge pas si j'ajoute le textArea avec traitement de compte de caractères !

par Truc » 05 nov. 2005, 03:22

C'est quoi exactement le probleme ?

Le contenu du champ texte (textarea) n'est pas entrée dans la BD ?
si c'est le cas affiche avec $_POST['description'].

Sinon le blocage des caratères fonctionne ?

par StarT » 05 nov. 2005, 03:19

J'ai toujours le même problème Truc :?

par Truc » 05 nov. 2005, 03:10

certainement a cause du "readonly" que tu ajoute dans le javascript:
 document.getElementById("log").setAttribute("readonly","");
enleve cette ligne et fait un test.

Les champs qui sont rendu "indisponible" (pas modifiable) ne sont pas envoyé et donc ne peuvent etre récupèré par POST.

Tu as 2 solutions:
soit mettre un cahmp caché qui contiendra le texte, a faire en javascript pour affecter le texte d'un champ a un autre champ.

soit de ne pas bloquer l'utilisation du champ de texte, si la personne se rend compte qu'elle a fait une erreur de frappe alors qu'elle a dépasée les 150 caratères il n'y aura plus moyen de modifier le texte. ajoute ces 2 ligne pour bloquer l'ajout de caratères sans pour autant bloquer le champ:
var texte = document.getElementById("description").value;
document.getElementById("description").value= texte.substring(0,150);
a la place de la ligne donné audessus avec le "readonly".

par StarT » 05 nov. 2005, 01:18

Merci Truc, ça marche très bien mais saus cette partie de code qui est destinée à faire réduire le nombre maximal de caractères qui est fixé à 150 caractères permis dans la zone de texte TextArea "description" qui contient le texte de l'annonce alors que moi je veux que ça marchera avec le upload + le traitement de caractères limités

voila la partie conscrée au traitement de caractères limités :
************ la fonction du traitement ! ***************
function controle()
{
max=150;
a=document.form1.description.value.length;
b=(max-a);

if (a <= max)document.getElementById("nbre").innerHTML="Il ne vous reste plus que "+b+" caractères";

else
{
document.getElementById("nbre").innerHTML="Vous ne pouvez plus entrer de caractères";
document.getElementById("log").setAttribute("readonly","");
}
}
</script>

************ la forme du traitement ! ***************

<table width="100%" border="0">
<form>
<tr>
<td width="46%" align="center" valign="top"><br> <span class="txt11">
<div align="center">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="txt11">Texte de votre annonce</td>
</tr>
<tr>
<td><span id="nbre" class="txt10"></span></td>
</tr>

</table>
</div>
</span><br> </td>
<td width="54%"><span class="txt11">

<textarea name="description" cols="40" rows="4" class="txt1" id="description" onKeyPress="controle()"></textarea>
</span></td>
</tr>
</form>
</table>
voilà le code en entier :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<link href="../tester/style.css" rel="stylesheet" type="text/css">
<title>:: Test </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--Fireworks 8 Dreamweaver 8 target.  Created Mon Oct 31 13:28:32 GMT+0000 (Greenwich) 2005-->
<style type="text/css">
<!--
body {
	background-color: #F49902;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style2 {FONT-FAMILY:Tahoma; COLOR: #ECC600; font-size: 11px;}
.style1 {color: #FFFFFF}
.style3 {	FONT-FAMILY: Tahoma;
	COLOR: #ECC600;
	font-size: 12px;
	font-weight: bold;
}
.style5 {FONT-FAMILY: Tahoma; COLOR: #BC1B2B; font-size: 12px; font-weight: bold; }
-->
</style>
<script language="JavaScript"> 
function controle() 
{ 
    max=150; 
    a=document.form1.description.value.length; 
    b=(max-a); 
     
    if (a <= max)document.getElementById("nbre").innerHTML="Il ne vous reste plus que "+b+" caractères"; 
         
    else 
        { 
            document.getElementById("nbre").innerHTML="Vous ne pouvez plus entrer de caractères"; 
            document.getElementById("log").setAttribute("readonly",""); 
        } 
} 
</script> 
</head>
<body>
<table width="785" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- fwtable fwsrc="charte1.png" fwbase="index.jpg" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
  <tr>
   <td><img src="../tester/images/spacer.gif" width="12" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="12" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="14" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="118" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="16" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="49" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="50" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="61" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="407" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="28" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="17" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="1" border="0" alt=""></td>
  </tr>

  <tr>
   <td colspan="12"><img name="index_r1_c1" src="../tester/images/index_r1_c1.jpg" width="785" height="4" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="4" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="4" colspan="3"><img name="index_r2_c1" src="../tester/images/index_r2_c1.jpg" width="38" height="71" border="0" alt=""></td>
   <td rowspan="3" colspan="4"><img name="index_r2_c4" src="../tester/images/index_r2_c4.jpg" width="184" height="68" border="0" alt=""></td>
   <td colspan="5"><img name="index_r2_c8" src="../tester/images/index_r2_c8.jpg" width="563" height="5" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="5" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="3"><img name="index_r3_c8" src="../tester/images/index_r3_c8.jpg" width="50" height="66" border="0" alt=""></td>
   <td colspan="2"><img name="index_r3_c9" src="../tester/images/index_r3_c9.jpg" width="468" height="60" border="0" alt=""></td>
   <td rowspan="3" colspan="2"><img name="index_r3_c11" src="../tester/images/index_r3_c11.jpg" width="45" height="66" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="60" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="2" colspan="2"><img name="index_r4_c9" src="../tester/images/index_r4_c9.jpg" width="468" height="6" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="3" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="4"><img name="index_r5_c4" src="../tester/images/index_r5_c4.jpg" width="184" height="3" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="3" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="12" background="../tester/images/index_r6_c1.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr>
       <td width="39%">&nbsp;</td>
       <td width="57%" class="txt11"><div align="center">Home   |  Qui sommes-nous     |   Contact   |   Publicit&eacute;   |   S'abonner  |   Favoris</div></td>
       <td width="4%">&nbsp;</td>
     </tr>
   </table></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="36" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="12"><img name="index_r7_c1" src="../tester/images/index_r7_c1.jpg" width="785" height="9" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="9" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="5"><img name="index_r8_c1" src="../tester/images/index_r8_c1.jpg" width="172" height="10" border="0" alt=""></td>
   <td colspan="6" rowspan="15" bgcolor="#BC1B2B">
  <fieldset>
<table width="100%" height="100%" border="0">
<form name="form1" method="post" action="t2.php" enctype="multipart/form-data">
  <tr> 
          <td height="15" colspan="5" bgcolor="#ECC600" class="style5"><div align="left">D&eacute;tails 
            de votre Annonces : </div></td>
        </tr>
  <tr>
    <td width="20%" class="txt11"><div align="left">Type annonce</div></td>
    <td width="28%" class="txt11">
      
          <div align="left">
            <select name="typeAnnonce" class="txt1">
              <option value="">S&eacute;lectionnez</option>
              <option value="1">Demande</option>
              <option value="0">Offre</option>
            </select>
            </div></td>
    <td width="27%"><div align="left"><span class="txt11">Indiquez votre parution</span></div></td>
    <td width="25%"><div align="left"><span class="txt11">
      <select name="parution" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? 
						include("gestion/config.php");
						$select=mysql_query("SELECT porution FROM parution order by id_porution"); 
					 
								while ($row = mysql_fetch_array($select))
								{
									$porution= $row["porution"];
									echo"<option value=\"$porution\">";
										echo"$porution";
									echo"</option>";
								} ?>
      </select>
    </span></div></td>
  </tr>
  <tr>
    <td class="txt11"><div align="left">Rubrique</div></td>
    <td class="txt11">
      
          <div align="left">
            <select name="rubrique" class="txt1">
              <option value="">S&eacute;lectionnez</option>
              <option value="0">Vente</option>
              <option value="1">Location</option>
            </select>
            </div></td>
    <td><div align="left"></div></td>
    <td><div align="left"></div></td>
  </tr>
  <tr>
    <td><div align="left"><span class="txt11">Type du bien </span></div></td>
    <td><div align="left"><span class="txt11">
      <select name="sub_type_achat" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? 
					 $select = mysql_query("select * from typeachat");
								while ($row = mysql_fetch_array($select))
								{
									$type_achat = $row["type_achat"];
									echo"<option value=\"$type_achat\">";
										echo"$type_achat";
									echo"</option>";
								
								}
							
						
							?>
      </select>
    </span></div></td>
    <td><div align="left"><span class="txt11">Pays du bien </span></div></td>
    <td><div align="left"><span class="txt11">
      <select name="pays_combo" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? 
						include("gestion/config.php");
						$select=mysql_query("SELECT DISTINCT pays, id_pays FROM pays order by id_pays"); 
					 
								while ($row = mysql_fetch_array($select))
								{
									$pays= $row["pays"];
									echo"<option value=\"$pays\">";
										echo"$pays";
									echo"</option>";
								} ?>
      </select>
    </span></div></td>
    </tr>
  <tr>
    <td><div align="left"><span class="txt11">ville du bien </span></div></td>
    <td><div align="left"><span class="txt11">
      <select name="Ville" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? $select=mysql_query("SELECT DISTINCT ville, id_ville FROM villes order by ville"); 
					 
								while ($row = mysql_fetch_array($select))
								{
									$ville = $row["ville"];
									echo"<option value=\"$ville\">";
										echo"$ville";
									echo"</option>";
								} ?>
      </select>
    </span></div></td>
    <td><div align="left"><span class="txt11">NB Pi&egrave;ces </span></div></td>
    <td><div align="left"><span class="txt11">
      <select name="sub_type_logement" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? 
								$select2 = mysql_query("select * from logement");
								while ($row = mysql_fetch_array($select2))
								{
									$sub_type_logement = $row["type_logement"];
									echo"<option value=\"$sub_type_logement\">";
										echo"$sub_type_logement";
									echo"</option>";
								
								}
							

							?>
      </select>
    </span></div></td>
    </tr>
  <tr>
    <td colspan="4" class="txt11"><div align="left">
      <table width="100%" border="0">
              <form>
                      <tr> 
                        <td width="46%" align="center" valign="top"><br> <span class="txt11"> 
                          <div align="center"> 
                            <table width="100%" border="0" align="center"  cellpadding="0" cellspacing="0">
                              <tr> 
                                <td class="txt11">Texte de votre annonce</td>
                              </tr>
                              <tr> 
                                <td><span  id="nbre"  class="txt10"></span></td>
                              </tr>
							  
                            </table>
                          </div>
                          </span><br> </td>
                        <td width="54%"><span class="txt11"> 
                          
              <textarea name="description" cols="40" rows="4"  class="txt1" id="description" onKeyPress="controle()"></textarea>
                          </span></td>
                      </tr>
                    </form>
      </table>
    </div></td>
    </tr>
  <tr>
    <td colspan="2" class="txt11"><div align="left"><span class="txt11">T&eacute;l&eacute;phonne/ E-mail 
      &agrave; faire figurer dans l'annonce </span></div></td>
    <td colspan="2">
      
          <div align="left">
            <input name="telEmail" type="text" class="txt1">
            </div></td>
    </tr>
  <tr>
    <td colspan="2" class="txt11"><div align="left"><span class="txt11">La photo &agrave; inserer dans 
      l'annonce (+30 DH) </span></div></td>
    <td colspan="2">
      
          <div align="left">
            <input type="file" name="photo" class="txt1"/>      
            </div></td>
    </tr>
   <tr> 
          <td height="15" colspan="4" bgcolor="#ECC600"><div align="left"><span class="style5">Vos 
            Coordonn&eacute;es : </span><span class="txt1"> ces renseignements 
            sont confidentiels au journal. </span></div></td>
        </tr>
  <tr>
    <td class="txt11"><div align="left">Nom et Pr&eacute;nom </div></td>
    <td class="txt11">
      
          <div align="left">
            <select name="Identif" class="txt1">
              <option value="Mme">Mme</option>
              <option value="Mme">Mlle</option>
              <option value="Mr">Mr</option>
            </select>
            </div></td>
    <td class="txt11">
      
          <div align="left">
            <input name="Nom" type="text" class="txt1">
            </div></td>
    <td class="txt11">
      
              <div align="left">
                <input name="Prenom" type="text" class="txt1">
              </div></td>
  </tr>
  <tr>
    <td><div align="left"><span class="txt11">Adresse</span></div></td>
    <td><div align="left"><span class="txt11">
      <input name="Adresse" type="text" class="txt1">
    </span></div></td>
    <td align="left"><div align="left"><span class="txt11">ville</span></div></td>
    <td><div align="left"><span class="txt11">
      <select name="txtvill" class="txt1">
        <option value="0">S&eacute;lectionnez</option>
        <? $select=mysql_query("SELECT DISTINCT ville, id_ville FROM villes order by ville"); 
					 
								while ($row = mysql_fetch_array($select))
								{
									$ville = $row["ville"];
									echo"<option value=\"$ville\">";
										echo"$ville";
									echo"</option>";
								} ?>
      </select>
    </span></div></td>
  </tr>
  <tr>
    <td><div align="left"><span class="txt11"> T&eacute;l. Bureau </span></div></td>
    <td><div align="left"><span class="txt11">
      <input name="TelBureau" type="text" class="txt1">
    </span></div></td>
    <td><div align="left"><span class="txt11">T&eacute;l. Dom </span></div></td>
    <td><div align="left"><span class="txt11">
      <input name="TelDomicile" type="text" class="txt1">
    </span></div></td>
  </tr>
  <tr>
    <td><div align="left"><span class="txt11">
      </span><span class="txt11"></span><span class="txt11">
      </span><span class="txt11"></span></div>
      <span class="txt11"><label></label>
      </span>
      </td>
    <td><div align="left"></div></td>
    <td><div align="left"></div></td>
  </tr>
  <tr> 
          <td height="15" colspan="4" bgcolor="#ECC600"><div align="left"><span class="style5">Mode 
            de paiement : </span></div></td>
        </tr>
  <tr>
    <td colspan="3"class="txt11">Envoyer votre ch&egrave;que libell&eacute; 
                  &agrave; l'ordre de : EDC , 357 Boulevard Mohamed V - Casablanca 
                  - Maroc T&eacute;l. +212 (0)22 40 78 16 - Fax : (0)22 40 78 
                  14 </td>
    <td><div align="right"><img src="img-/valid.jpg" width="82" height="20" onClick="form1.submit()"></div></td>
  </tr>
  </form>
</table>
<!-- champs d'envoi de fichier, de type file -->
</legend>
  </fieldset>
   </td>
   <td rowspan="16"><img name="index_r8_c12" src="../tester/images/index_r8_c12.jpg" width="17" height="404" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="10" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="15"><img name="index_r9_c1" src="../tester/images/index_r9_c1.jpg" width="12" height="394" border="0" alt=""></td>
   <td rowspan="2" colspan="3"><img name="index_r9_c2" src="../tester/images/index_r9_c2.jpg" width="144" height="24" border="0" alt=""></td>
   <td rowspan="15"><img name="index_r9_c5" src="../tester/images/index_r9_c5.jpg" width="16" height="394" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="20" border="0" alt=""></td>
  </tr>
  <tr>
   <td><img src="../tester/images/spacer.gif" width="1" height="4" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r11_c2" src="../tester/images/index_r11_c2.jpg" width="144" height="4" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="4" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r12_c2" src="../tester/images/index_r12_c2.jpg" width="144" height="16" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="16" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r13_c2" src="../tester/images/index_r13_c2.jpg" width="144" height="4" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="4" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r14_c2" src="../tester/images/index_r14_c2.jpg" width="144" height="17" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="17" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r15_c2" src="../tester/images/index_r15_c2.jpg" width="144" height="5" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="5" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r16_c2" src="../tester/images/index_r16_c2.jpg" width="144" height="22" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="22" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="2" colspan="3"><img name="index_r17_c2" src="../tester/images/index_r17_c2.jpg" width="144" height="41" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="33" border="0" alt=""></td>
  </tr>
  <tr>
   <td><img src="../tester/images/spacer.gif" width="1" height="8" border="0" alt=""></td>
  </tr>
  <tr>
   <td><img name="index_r19_c2" src="../tester/images/index_r19_c2.jpg" width="12" height="70" border="0" alt=""></td>
   <td colspan="2" bgcolor="#BC1B2B"><a href="#" class="style2">Architectes</a><br>
     <a href="#" class="style2">Promoteurs</a><br>
     <a href="#" class="style2">Bureaux d'&eacute;tudes</a><br>
     <a href="#" class="style2">G&eacute;om&egrave;tres/Topographes</a><br>
     <a href="#" class="style2"> Notaires</a></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="70" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r20_c2" src="../tester/images/index_r20_c2.jpg" width="144" height="69" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="69" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r21_c2" src="../tester/images/index_r21_c2.jpg" width="144" height="96" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="96" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="2" colspan="3"><img name="index_r22_c2" src="../tester/images/index_r22_c2.jpg" width="144" height="26" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="16" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="6"><img name="index_r23_c6" src="../tester/images/index_r23_c6.jpg" width="596" height="10" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="10" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="12"><img name="index_r24_c1" src="../tester/images/index_r24_c1.jpg" width="785" height="20" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="20" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="12"><img name="index_r25_c1" src="../tester/images/index_r25_c1.jpg" width="785" height="1" border="0" alt=""></td>
   <td><img src="../tester/images/spacer.gif" width="1" height="1" border="0" alt=""></td>
  </tr>
</table>
</body>
</html>

par Truc » 03 nov. 2005, 20:10

Alors tu as cette ligne
$photo  = isset($_POST['photo '])    ? $_POST['photo ']    :
tu essai donc de récupèrer le contenu du champ file nomé "photo" or ici tu as "photo " avec un espace a la fin, donc cet index n'eiste pas et le test va toujours renvoyer $photo="";

c'est donc ceci qui va etre inséré dans la BD !

Mais meme si tu réctifie tu ne va pas récupèrer ce que tu veut ! en effet un echo $_POST['photo ']; va afficher => "array" puisque c'est un tableau multidirectionel exemple $_POST['photo ']['name'] !

Tu dois donc inserer le nom qu'aura l'image sur le ftp ici $dest_fichier

Tu peut aussi ajouter un test pour savoir si l'upload s'est bien éffectué:
if(move_uploaded_file($_FILES['photo']['tmp_name'], $dest_dossier . $dest_fichier))
{
   //l'upload est ok
   $fichier_bd=$dest_fichier;
}
else
{
   // probleme d'upload
   $fichier_bd="valeur par défaut";
}

avec ce code tu insere donc la variable $fichier_bd dans la base de données.

par StarT » 03 nov. 2005, 03:48

oui tout est bon, mes données sont très bien enregistrées dans ma BDD sauf l'image d'upload ! c'est ça que je ne comprends pas :roll:

par Truc » 03 nov. 2005, 02:16

Hmm oui alors deja Bonsoir (que je suis mal poli moi :oops: )

Mais en gros je voi toujours pas le probleme si tu as repris de code de la fac il ne devrai pas y avoir de problemes.

C'est normal de mettre un formulaire pour le champ de type "fichier" et le bouton valider, c'est un champ comme tous les autres tu peut donc l'inclure dans le reste du fomulaire avec les noms, prenoms, etc... et récupérer dans ce fichier que tu nous montres.

L'upload se fait fait ?

La récupération des variables est ok ? (mais je me demande pourquoi tu les passe en POST et en GET :-k )

Les requetes sont bonnes aussi ?

Pas de message d'erreur ? :-k