File "upload_multiple03.php"
Full Path: /home/analogde/www/Freebox/CHESS_ON/upload_multiple03.php
File size: 1.14 KB
MIME-type: text/x-php
Charset: utf-8
<?php
session_start();
$upload_repertoire = $_SESSION['upload_repertoire'];
//echo "++++ " .$upload_repertoire;
$tab = array();
$cpt = 0;
foreach($_FILES as $index => $file)
{
$fileName = $file['name'];
$fileTempName = $file['tmp_name'];
/*if(file_exists('uploads/' .$fileName ))
{
echo 'Le fichier ' .$fileName .' existe est !';
}*/
/*else
{*/
// check whether file has temporary path and whether it indeed is an uploaded file
if(!empty($fileTempName) && is_uploaded_file($fileTempName))
{
// move the file from the temporary directory to somewhere of your choosing
//move_uploaded_file($fileTempName, "uploads/" . $fileName);
move_uploaded_file($fileTempName, $upload_repertoire . $fileName);
//echo '<p>Click <strong><a href="uploads/' . $fileName . '" target="_blank">' . $fileName . '</a></strong> to download it.</p>';
}
$tab[] = $fileName;
/*} */
$cpt = $cpt + 1;
}
if( $cpt > 1)
{
$s = "Fichiers envoyés:";
}
else
{
$s = "Fichier envoyé:";
}
$s .= "<br><br>";
for ($i = 0; $i < count($tab) ; $i++)
{
$s .= $tab[$i] ."<br>";
}
echo $s
?>