| |||||
| Dernière réponse | |
|---|---|
| Sujet : [PHP] Upload image | |
| SquiiiD | lol te repondre a koa??? tu t po gourré de post toa? :heink: :heink: :heink: |
| Aperçu |
|---|
| Vue Rapide de la discussion |
|---|
| SquiiiD | lol te repondre a koa??? tu t po gourré de post toa? :heink: :heink: :heink: |
| Raph2209 | up, aide moi svp....... :( :( :( :( :( :( :( :cry: |
| Raph2209 | up :) |
| Raph2209 | personne ne peut m'aider ??????? |
| Raph2209 | up :D |
| sanogyl | merci atrsurf pour t'as réponse, mais je vroudrais savoir si avce ces codes sources la, on peut le faire ?
ANNEXE : le contenu des 2 pages : ############ AJOUTER.php3 ########### <HTML><HEAD><TITLE> : l'admin</TITLE> <STYLE> BODY { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana, Helvetica, Arial } P { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana, Helvetica, Arial } TD { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana, Helvetica, Arial } LI { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana, Helvetica, Arial } A:link { FONT-SIZE: 11px; COLOR: navy; FONT-FAMILY: Verdana, Helvetica, Arial; TEXT-DECORATION: none } A:visited { FONT-SIZE: 11px; COLOR: navy; FONT-FAMILY: Verdana, Helvetica, Arial; TEXT-DECORATION: none } A:hover { FONT-SIZE: 11px; COLOR: navy; FONT-FAMILY: Verdana, Helvetica, Arial; TEXT-DECORATION: underline } A.droite:link { FONT-SIZE: 11px; COLOR: #e0e0e0; FONT-FAMILY: Verdana, Helvetica, Arial; TEXT-DECORATION: none } A.droite:visited { FONT-SIZE: 11px; COLOR: #e0e0e0; FONT-FAMILY: Verdana, Helvetica, Arial; TEXT-DECORATION: none } A.droite:hover { FONT-SIZE: 11px; COLOR: #e0e0e0; FONT-FAMILY: Verdana, Helvetica, Arial; TEXT-DECORATION: underline } FONT.erreur { FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: white; FONT-FAMILY: Verdana, Helvetica, Arial; BACKGROUND-COLOR: red } FONT.merci { FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: white; FONT-FAMILY: Verdana, Helvetica, Arial; BACKGROUND-COLOR: navy } P.titre { FONT-WEIGHT: bold; FONT-SIZE: 18px; FONT-FAMILY: Verdana, Arial; TEXT-ALIGN: center } INPUT { FONT-SIZE: 11px; FONT-FAMILY: Verdana, Helvetica, Arial } SELECT { FONT-SIZE: 11px; FONT-FAMILY: Verdana, Helvetica, Arial } TEXTAREA { FONT-SIZE: 11px; FONT-FAMILY: Verdana, Helvetica, Arial } </STYLE> </HEAD> <BODY bgColor=#000000 leftMargin=0 text="#FFFFFF" topMargin=0 marginheight="0" marginwidth="0" link="#003399"> <table cellspacing=0 cellpadding=0 width=552 border=0 height="186" align="center"> <tbody> <tr> <td height="292"> <div style="TEXT-ALIGN: justify"> <center> <font size="3" face="Verdana" color="white"><b><u>AJOUTER UN ROMS</u></b></font><br><<form method="POST" action="roms_ajouter_verif.php3?cat=<?echo $cat; ?>"> <table bordercolor="#000060" cellspacing=0 cellpadding=0 width="609" border=1 bordercolordark="#000060" bordercolorlight="#000060"> <tbody> <tr bgcolor="#000059"> <td width="299" bordercolor="#000060"> <div style="TEXT-ALIGN: justify"> <p align="center"><font color="white"><b>Nom</b> <b>:</b> </font><font color="red">*</font><font color="white"> </font>:<br><input type="text" name="nom" maxlength="255" style="color:white; background-color:rgb(0,0,88); border-width:1; border-color:white; border-style:solid;"></p> </div> </td> <td width="304" bordercolor="#000060"> <div style="TEXT-ALIGN: justify"> <p align="center"><font color="white"><b>URL download :</b></font><font color="red">*</font><br><input type="text" name="down" maxlength="5000" style="color:white; background-color:rgb(0,0,88); border-width:1; border-color:white; border-style:solid;" value="http://www.bubblegame.net/" size="28"></p> </div> </td> </tr> <tr bgcolor=#F0F0FF> <td width="299" height="215" valign="top" bgcolor="black" bordercolor="#000060"> <center> <font color="white"><b> <br> <u><br></u></b></font> </center> <table border="0" width="295"> <tr> <td width="84"> <p><font color="white"><b>Image :</b></font></p> </td> <td width="201"> <p align="left"> <p><input type="file" name="file_name" enctype="multipart/form-data" size="20" style="color:silver; background-color:black; border-width:1; border-color:white; border-style:solid;"><br> <input type="hidden" name="MAX_FILE_SIZE" value="100000"> </td> </tr> <tr> <td width="84"> <p><b><font color="white">Note :</font></b></p> </td> <td width="201"> <p><input type="text" name="note" maxlength="255" style="color:silver; background-color:black; border-width:1; border-color:white; border-style:solid;" size="25"></p> </td> </tr> <tr> <td width="84"> <p><font color="white"><b>Taille :</b></font></p> </td> <td width="201"> <div style="TEXT-ALIGN: justify"> <p align="left"><input type="text" name="taille" maxlength="255" style="color:silver; background-color:black; border-width:1; border-color:white; border-style:solid;" size="25"></p> </div> </td> </tr> <tr> <td width="84"> <p> </p> </td> <td width="201"> <p> </p> </td> </tr> </table> <p align="center"> <br><font color="white" size="2"><img src="rafsoft3.gif" width="88" height="31" border="0"></font> </p> </td> <td width="304" align="left" valign="top" bgcolor="black" bordercolor="#000060" height="215"> <div style="TEXT-ALIGN: justify"> <p align="left"><font color="white"> </font></p> </div> <table border="0" width="309"> <tr> <td width="93" height="151"> <div style="TEXT-ALIGN: justify"> <p align="right"><font color="white"><b>Commentaire :</b></font></p> </div> </td> <td width="206" height="151"> <p><textarea name="description" rows="8" cols="27" style="color:silver; background-color:black; border-width:1; border-color:white; border-style:solid;"></textarea></p> </td> </tr> </table> <div style="TEXT-ALIGN: justify"> <p align="center"><font color="red">*</font><font color="white"> </font><font color="red">= Champs Obligatoires pour un fonctionnement correct<br> </font></p> </div> </td> </tr> <tr> <td width="605" height="29" valign="top" bgcolor="black" bordercolor="#000060" colspan="2"> <p align="center"><input onClick="Javascript:window.location='emul_index.php3';" name="retour" value="<<<< INDEX" style="color:silver; background-color:black; border-color:red; border-style:solid;"> <input type="reset" name="annul" value="EFFACER" style="color:silver; background-color:black; border-width:1; border-color:red; border-style ashed;"> <input type="submit" name="envoi" value="AJOUTER >>>>" style="color:silver; background-color:black; border-width:2; border-color:red; border-style:solid;"></p> </td> </tr> </tbody> </table> </form> </center> </div> </td> </tr> </tbody> </table> <p align="center"><a href="raphsoft.php3"><font color="white">Script Gestion roms 1.0 de RAPH'SOFT<br></font><font color="white" size="2">© R. & Raph ' SOFT 2001</font></a><font color="white" size="2"><br> </font></p> </BODY></HTML> ######### AJOUTER_VERIF.php3 ############" <? require("../config.php3" ); $img="$dest_file"; if($cat=="Atari2600" ) { $table="roms_2600"; } if($cat=="Atari5200" ) { $table="roms_5200"; } if($cat=="Atari7800" ) { $table="roms_7800"; } if($cat=="gameboy" ) { $table="roms_gameboy"; } if($cat=="gbavance" ) { $table="roms_avance"; } if($cat=="MegaDrive" ) { $table="roms_mdrive"; } if($cat=="geopocket" ) { $table="roms_geopocket"; } if($cat=="pcengine" ) { $table="roms_pcengine"; } ********* Voilà merci A+ |
| atrsurf | Ce script marche bien.
dans l'include il y a les param de connexion. Il faut juste changer les droits du répertoire et ca devrait marcher..... Aprè stu mets un lien vers l'image uploadé !! <?php include("parametre.php3" ); connexion(); ?> <html> <head> <title> Upload de fichiers </title> </head> <body> <center> <? /*------------------------------------------------ ------------- VARIABLE(S) A MODIFIER --------------------------------------------------------------*/ // Chemin du répertoire de destination, exemples pour : // windows : $destination="C:\\windows\\temp"; // unix : $destination="/usr/WWW/tmp"; $destination="download"; // Taille maximale autorisée en octets $taille=1512000; /*------------------------------------------------------------- CAS : ENREGISTREMENT DU FICHIER SUR LE SERVEUR --------------------------------------------------------------*/ switch($action) { case "add"; if ($userfile_size!=0) {$taille_ko=$userfile_size/1024;} else {$taille_ko=0;} if ($userfile=="none" ) {$message="<h2><font face=arial>Vous n'avez pas sélectionné de fichier.</font></h2>";} if ($userfile_size>$taille) { if($taille!=0) { $taille_max_ko=$taille/1024; } $message="<h2><font face=arial>Votre fichier est trop gros ($taille_max_ko ko max)</font></h2>"; } if ($userfile!="none" && $userfile_size<$taille && $userfile_size!=0) { $userfile=stripslashes($userfile); // pour windows if (!copy($userfile, "$destination/$userfile_name" )) { $message="<br>Probleme de transfert !<br>"; } else { $message="<h2><font face=arial>Fichier enregistré</font></h2>"; } } printf ("$message<br>taille=%.2f ko.",$taille_ko); break; /*------------------------------------------------------------- CAS : AFFICHAGE DU FORMULAIRE --------------------------------------------------------------*/ default; echo "<h2><font face=arial>Upload de fichiers</font></h2>"; echo "Choisissez un fichier sur votre disque et cliquez sur Envoyer<br> <FORM ENCTYPE=\"multipart/form-data\" ACTION=\"upload.php3\" METHOD=\"post\"> <input type=\"hidden\" name=\"action\" value=\"add\"> <INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"10000000\"> <INPUT NAME=\"userfile\" TYPE=\"file\" size=\"20\"><br> <input type=\"submit\" value=\"Envoyer\"></FORM>"; break; } ?> </center> </body> </html> [edtdd]--Message édité par atrsurf--[/edtdd] |
| sanogyl | up |
| sanogyl | Salut tlm
g un form (fichier ajouter.php3 ou l'on entre des infos et un autre fichier (ajouter_verif.php3) qui est le "action" du form, et ce fichier ajoute ds Mysql les infos rempli ds le form, jusque la, pas de pb. Mais ce que je veux faire c que lorsque l'on veux mettre une img, plutot que de taper l'url ds le champ approprie, que l'on puissent uploader le fichier que l'on aura choisi (ds ajouter.php3) et que ca l'upload sur le serveur et que l'info ds Mysql soit le nom du fichier que l'on vient d'uploader (ainsi que les autre champ bien entendu... g deja essayer d'utiliser un script, ca a foiré.... alors, si vous pouviez m'aide, ce serai pas mal.... merci A+ |




