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 33 34
| <?php
// Dossier de destination du fichier
$folder = "C:/Documents and Settings/Easy/Bureau/SiteWeb/www/dep/";
// Tableau array des différents types
$allowed_types = array("application/pdf");
$fsize = $HTTP_POST_FILES['fichier']['size'];
$fname = $HTTP_POST_FILES['fichier']['name'];
$ftype = $HTTP_POST_FILES['fichier']['type'];
$fsize = $HTTP_POST_FILES['fichier']['size'];
$ftmp = $HTTP_POST_FILES['fichier']['tmp_name'];
echo "Taille : $fsize"; echo "<br>";
echo "Nom Fichier : $fname"; echo "<br>";
echo "Type : $ftype"; echo "<br>";
echo "Chemin : $ftmp"; echo "<br>";
if(copy($ftmp,''.$folder.''.$fname.'')) {$error = 0;}
if(!in_array($ftype, $allowed_types)){$error = 1;}
switch($error){
case'1':
echo("Format de fichier incorrecte.");
break;
case'0':
echo("Copie réussie");
break;
}
?> |
Partager