[Resolut]-Upload de fichier qui bug

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 : [Resolut]-Upload de fichier qui bug

par Cyrano » 07 août 2005, 13:07

Tazzie, attention quand tu envoies du code, tu n'est pas obligé de nous laisser tes codes d'accès à ton compte free.fr : j'ai édité et masqué. Sois prudent.

Pour ton problème, as-tu regardé le tuto sur l'upload de fichiers ?

[Resolut]-Upload de fichier qui bug

par Tazzie » 07 août 2005, 12:39

Salut, alors voila j'ai un code d'upload mais y bug, et je sais pas pourquoi.

Code : Tout sélectionner

<?php $target = ''; $nom_file = $_FILES['fichier']['name']; $taille = $_FILES['fichier']['size']; $tmp = $_FILES['fichier']['tmp_name']; if(!empty($_POST['posted'])) { if(move_uploaded_file($_FILES['fichier']['tmp_name'],$target.$_FILES['fichier']['name'])) { mysql_pconnect("sql.free.fr", "*******" , "*******") or die("erreur"); mysql_select_db("skullnbones") or die("Base de données non trouvée."); $sql = "INSERT INTO upfile(fichier) VALUES('<a href=\'http://skullnbones.free.fr/".$nom_file."\' target=_blank >~~".$nom_file."~~</a> a été posté par ".$nom."')"; mysql_query($sql) or die (mysql_error()."<br>$sql"); echo "<META HTTP-EQUIV=Refresh CONTENT='0; URL=index.php'>"; } else { echo 'Merci de remplir tous le champs :)'; } } ?> <form enctype="multipart/form-data" action="<?php echo $PHP_SELF; ?>" method="POST"> <p style="margin-top: 0; margin-bottom: 0"> <table border="0" width="100%"> <tr> <td width="20%"> <p style="margin-top: 0; margin-bottom: 0">Fichier:&nbsp;&nbsp;</p> <p style="margin-top: 0; margin-bottom: 0">&nbsp;</p> <p style="margin-top: 0; margin-bottom: 0">Nom :&nbsp;</td> <td width="80%"> <p style="margin-top: 0; margin-bottom: 0"><input type="hidden" name="posted" value="1" /><input name="fichier1" type="file" /> &nbsp;</p> <p style="margin-top: 0; margin-bottom: 0">&nbsp;</p> <p style="margin-top: 0; margin-bottom: 0"><input type="text" name="nom1" size="20"></td> </tr> </table> <p style="margin-top: 0; margin-bottom: 0">&nbsp;<br /> <input type="hidden" name="posted" value="1" /><input type="submit" value="Uploader" /> </p> </form>
Meme si je remplie tous le champs, il me met le message 'Merci de remplir tous le champs :)'

Help svp :p
Probleme resolu ! j'avait mis name=fichier1 et name=nom1, il faller pas les 1.

Dsl pour le mot de pass et pour cette erreur bete! :)