<?php

	session_start();

	
	$upload_repertoire = $_SESSION['upload_repertoire'];
	
	echo "++++ " .$upload_repertoire;

	$tab = array();
 	
	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;
		/*}	*/
			
	}
	
	$s = "Fichiers envoyés:";
	$s .= "<br><br>";
	$str = implode(" ", $tab);	
	$s .= $str;  
	echo $s
?>


