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
$maxfiles = 3;
$maxsize = 2000000;
$finaldir = './';
if(isset($_POST['valider'])){
$nbr=0;
for($x=0;$x<$maxfiles;$x++)
if(!empty($_FILES['userfile']['name'][$x])) $nbr++;
if($nbr<=0) die("Aucun fichier spécifié !<br/>");
for($x=1;$x<=$maxfiles;$x++)
{
$errorhttp=$_FILES['userfile']['error'][$x-1];
$filenamehttp = $_FILES['userfile']['name'][$x-1];
$typehttp=$_FILES['userfile']['type'][$x-1];
$sizehttp=$_FILES['userfile']['size'][$x-1];
$tmpfilehttp=$_FILES['userfile']['tmp_name'][$x-1];
if(@move_uploaded_file($tmpfilehttp,$finaldir.$filenamehttp))
{
@chmod($filenamehttp,0777);
echo "Fichier n°$x uploadé : ".basename($filenamehttp). " (".round(max($sizehttp,1024)/1024)." ko)<br/>";
die ("Opération terminée.<br/>");
}
else
{
phpinfo();
}
}
} |
Partager