Je souhaiterai importer un fichier sur mon serveur. J'ai donc suivi le tuto suivant : http://www.commentcamarche.net/faq/889- ... e-fichiers
Cependant, un gros problème... Si le fichier est supérieur a une taille que je choisis, alors il me l'indique, mais qu'aprés l'avoir téléchargé en "tampon"... Car j'ai mis la condition :
$File_size = $_FILES['nom_du_fichier']['size'];
if ($File_size > "2097153"){echo("$Erreur_taille"); $Envoi = 0;}
Avez-vous une solution pour que la vérification soit effectuée dès que je choisi le fichier, par exemple, ou alors dès que je tente de poster mon formulaire ci-dessous :Code : Tout sélectionner
<form id="form1" name="form1" method="post" action="?id=admin_produits_add_valid" enctype="multipart/form-data">
<p> </p>
<table width="480" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100" height="27" align="left" valign="top"><strong>Catégorie</strong></td>
<td width="30" height="27" align="left" valign="top"><div align="left"><strong>:</strong></div></td>
<td height="27" align="left" valign="top"><select name="Categorie" id="Categorie" enctype="multipart/form-data">
<option style="font-weight:bold; color:#FF0000" value="0">-------- Catégories --------</option>
<option value="<?php echo $Produit_1; ?>"><?php echo $Produit_1_name; ?></option>
<option value="<?php echo $Produit_2; ?>"><?php echo $Produit_2_name; ?></option>
<option value="<?php echo $Produit_3; ?>"><?php echo $Produit_3_name; ?></option>
<option value="<?php echo $Produit_4; ?>"><?php echo $Produit_4_name; ?></option>
<option value="<?php echo $Produit_5; ?>"><?php echo $Produit_5_name; ?></option>
<option value="<?php echo $Produit_6; ?>"><?php echo $Produit_6_name; ?></option>
<option value="<?php echo $Produit_7; ?>"><?php echo $Produit_7_name; ?></option>
<option value="<?php echo $Produit_8; ?>"><?php echo $Produit_8_name; ?></option>
<option value="<?php echo $Produit_9; ?>"><?php echo $Produit_9_name; ?></option>
<option value="<?php echo $Produit_10; ?>"><?php echo $Produit_10_name; ?></option>
</select></td>
</tr>
<tr>
<td width="100" height="27" align="left" valign="top"><strong>Titre</strong></td>
<td width="30" height="27" align="left" valign="top"><div align="left"><strong>:</strong></div></td>
<td height="27" align="left" valign="top"><input name="Titre" type="text" id="Titre" value="<? echo $_COOKIE['Titre']; ?>
" size="50" maxlength="50"/></td>
</tr>
<tr>
<td height="27" align="left" valign="top"><strong>Description</strong></td>
<td height="27" align="left" valign="top"><div align="left"><strong>:</strong></div></td>
<td height="27" align="left" valign="top"><textarea name="Description" cols="38" rows="5" id="Description"><? echo $_COOKIE['Description']; ?>
</textarea></td>
</tr>
<tr>
<td height="27" align="left" valign="top"><strong>Image</strong></td>
<td height="27" align="left" valign="top"><div align="left"><strong>:</strong></div></td>
<td height="27" align="left" valign="top"><input type="hidden" name="MAX_FILE_SIZE" value="2097152" />
<input type="file" name="nom_du_fichier"/>
<strong>( 2Mo max )</strong> </td>
</tr>
<tr>
<td height="27" align="left" valign="top"><strong>Prix TTC. </strong></td>
<td height="27" align="left" valign="top"><div align="left"><strong>:</strong></div></td>
<td height="27" align="left" valign="top"><input name="Prix" type="text" id="Prix" value="<? echo $_COOKIE['Prix']; ?>" size="10" maxlength="6" />
€</td>
</tr>
</table>
<br />
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="left">
<input type="reset" name="button22" id="button22" value="Réinitialiser" />
</div></td>
<td width="9"> </td>
<td><div align="right">
<input type="submit" name="button3" id="button3" value="Ajouter le produit" />
</div></td>
</tr>
</table>
</form>Fab