[Upload] Est-ce que ce script est suffisant pour uploader dans ma BD ?
salam wa alikoum :-)
je veut uploader des fichiers pour les mettres ensuite dans une table spécifique dana ma BD est ce que ces scriptes suffisent pour ça ?
est ce que je croi qu'il manque un (insert into....) non !
pour le formulaire c'est :
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
|
<form method="post" action="upload.php3" ENCTYPE="multipart/form-data">
<table width=503 border=0>
<tbody>
<tr>
<td align="right"><span class="Style3"><strong><span class="Style4"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Psudo :</font></span></strong></span></td>
<td><input id=pseudo
style="BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-WEIGHT: bold; FONT-SIZE: 8pt; BORDER-LEFT: #ffffff 1px solid; COLOR: #4d587b; BORDER-BOTTOM: #ffffff 1px solid; FONT-FAMILY: verdana; BACKGROUND-COLOR: #e0e5f4"
name=pseudo></td>
</tr>
<tr>
<td width=226 align="right">
<div align=right class="Style3"><strong><strong><span class="Style4"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Fichier :</font></span></strong></strong></div></td>
<td width=267> <input type="file" name="file_name" enctype="multipart/form-data"style="BORDER-RIGHT: #4d587b 1px solid; BORDER-TOP: #4d587b 1px solid; FONT-WEIGHT: bold; FONT-SIZE: 8pt; BORDER-LEFT: #4d587b 1px solid; COLOR: #ffffff; BORDER-BOTTOM: #4d587b 1px solid; FONT-FAMILY: verdana; BACKGROUND-COLOR:#e0e5f4 ">
</td></tr> <input name="file_name" type="file" style="BORDER-RIGHT: #4d587b 1px solid; BORDER-TOP: #4d587b 1px solid; FONT-WEIGHT: bold; FONT-SIZE: 8pt; BORDER-LEFT: #4d587b 1px solid; COLOR: #ffffff; BORDER-BOTTOM: #4d587b 1px solid; FONT-FAMILY: verdana; BACKGROUND-COLOR: #4d587b" value="Parcourir">
<tr>
<td width=226 align="right" valign=top>
<div align=right><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><span class="Style4">Commentaire*: </span></font> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"></font></strong></div></td>
<td width=267>
<textarea id=commentaire style="BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-WEIGHT: bold; FONT-SIZE: 8pt; BORDER-LEFT: #ffffff 1px solid; COLOR: #4d587b; BORDER-BOTTOM: #ffffff 1px solid; FONT-FAMILY: verdana; BACKGROUND-COLOR: #e0e5f4" name=commentaire rows=5 cols=41></textarea>
</td>
</tr>
<tr>
<td valign=top width=226>
<div align=right></div></td>
<td width=267>
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
<input style="BORDER-RIGHT: #4d587b 1px solid; BORDER-TOP: #4d587b 1px solid; FONT-WEIGHT: bold; FONT-SIZE: 8pt; BORDER-LEFT: #4d587b 1px solid; COLOR: #ffffff; BORDER-BOTTOM: #4d587b 1px solid; FONT-FAMILY: verdana; BACKGROUND-COLOR: #4d587b" type="submit" value="Envoyer">
</td>
</tr>
</tbody>
</table></form> |
pour le scripte qui s'occupe de l'upload c'est :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
<?
if ($file_name == "none")
{
print "Spécifier un fichier à envoyer.";
}
else
{
/* indiquer $dest_file qui correspond au répertoire de destination */
$dest_file="files/name_of_file";
/* enlève un "\" */
$source_file=stripslashes($file_name);
/* copie du fichier */
$res_copy=copy($source_file , $dest_file);
print "Fichier envoyé.";
}
?> |
Merci