Source: lesson_07_get_file.php | Résultat |
<?php //ini_set('upload_max_filesize','5M'); $action_file="show_exercises.php?"; $action_file.="exercise=lesson_07_get_file.php"; if (!isset($_FILES['myFileName'])) { //dans la pratique la ligne suivante s'écrira //echo "<form action=$_SERVER[PHP_SELF] method=post>"; echo "<form action=$action_file method='post' enctype='multipart/form-data'>"; echo "<table border='1'>"; echo "<tr><td><INPUT NAME='myFileName' TYPE='file' size=30></td></tr>"; echo "<tr><td><input type='submit' name='submit' value=' Envoyer ' style='background-color:#CCCCCC'>"; echo "</td></tr></table>"; echo "</form>"; } else { echo "<table class=no_border border=1>"; print "<tr><td>Nom du fichier</td><td>". $_FILES['myFileName']['name']."</td></tr>"; print "<tr><td>Type</td><td>". $_FILES['myFileName']['type']."</td></tr>"; print "<tr><td>Tmp_name</td><td>". $_FILES['myFileName']['tmp_name']."</td></tr>"; print "<tr><td>Size</td><td>". $_FILES['myFileName']['size']."</td></tr>"; print "<tr><td>Error</td><td>". $_FILES['myFileName']['error']."</td></tr>"; print "</table><p>"; if (file_exists($_FILES['myFileName']['tmp_name'])) { echo "Le fichier temporaire ".$_FILES['myFileName'] ['tmp_name']." va être effacé"; unlink($_FILES['myFileName']['tmp_name']); } } ?>
|
|