<?php

	$images_arr = array();
	foreach($_FILES['images']['name'] as $key=>$val)
	{
		$image_name = $_FILES['images']['name'][$key];
		$tmp_name 	= $_FILES['images']['tmp_name'][$key];
		$size 		= $_FILES['images']['size'][$key];
		$type 		= $_FILES['images']['type'][$key];
		$error 		= $_FILES['images']['error'][$key];
		
		
		
		$target_dir = "uploads/";
		$target_file = $target_dir.$_FILES['images']['name'][$key];
		if(move_uploaded_file($_FILES['images']['tmp_name'][$key],$target_file))
		{
			$images_arr[] = $target_file;
			echo $target_file;
			echo "<br>";
		}
		echo "fin";
	}
	//session_start();

	//$nom_fichier = $_POST["fichier"];
	//$pieces = explode(",", $nom_fichier);
	
	
	/*$uploaddir = 'uploads/';
    $uploadfile = $uploaddir . $pieces[0];
	echo $uploadfile;
	
    if (move_uploaded_file($pieces[0], $uploadfile))
    {
		echo "Le fichier est valide, et a été téléchargé avec succès.\n ";
    } 
	else 
	{
		echo " Attaque potentielle par téléchargement de fichiers.\n ";
    }

	
	//http://www.kodingmadesimple.com/2015/04/jquery-multiple-file-upload-ajax-php.html
	
	echo $_POST["fichier"];*/
	echo "Telechargement OK";

?>