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
   | <?php
	session_start();
 
	if(isset($_POST['upload']))
	{
		include('../Connexion/connexion_ftp.php');
 
		set_time_limit(10000);
		$path = $_POST['path'];
		$uploaded = true;
 
		foreach ($_FILES["file"] as $key) 
		{
			if ($_FILES["file"]["error"] == 0)
			{
				$tmp_name = $_FILES["file"]["tmp_name"];
				$name = $_FILES["file"]["name"];
 
				$upload = ftp_put($ftp, $path."/".$name, $tmp_name, FTP_BINARY);
				if(!$upload)
				{
					$uploaded = false;
				}
			}
		}
		ftp_close($ftp);
		if($uploaded == false) header("Location: ../msg.php?msg=not_upload");
		else header("Location: ../msg.php?msg=upload");
	}else
	{
		header("Location: ../msg.php?msg=not_upload");
	}
?> | 
Partager