<?php
			session_start();

			$nom = $_POST['nom'];
			$operation = $_POST['operation'];
			
			$ancien_nom = $_SESSION['upload_fichier'];
			$_SESSION['renome'] = $nom;

			if($operation == "renomer")
			{
				//chdir("temp_upload");
				rename("temp_upload/" .$ancien_nom, "temp_upload/" .$nom);
				
				// copie du repertoire temporaire vers le dossier de stockage
				copy("temp_upload/" .$nom, "upload/" .$nom);
				// efface le fichier temp
				unlink("temp_upload/" .$nom);
				
			}
			
			
			/*
			/*if($operation == "ecraser")
			{
				chdir("images");
				rename($ancien_nom, $nom);
				echo "ok_ecrase";
			}*/
			/*
			if($operation == "renomer")
			{
				chdir("temp_upload");
				rename($ancien_nom, $nom);
				
				
			//	copy($nom, "upload/" .$nom);
			//	unlink($nom);
				
				echo "ok_renome";
			}

			*/
			
			
			
?>