Tu as raison je n'ai pas pris le bon script.
Pour l'instant il y a un script avec un formulaire qui en lance un second :
	
	| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 
 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
 <head>
  <title>Formulaire d'upload</title>
 </head>
 <body>
  <form method="post" enctype="multipart/form-data" action="upload.php">
   <p>
    <label>Sélectionnez un répertoire :
    <-- <input type="dirname" name="repertoire" /> -->
	<input type="file" name="fichier" />
    </label>
   </p>
   <p><input type="submit" value="Envoyer" /></p>
  </form>
 </body>
</html> | 
 
Et le script appelé :
	
	| 12
 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
 34
 35
 36
 37
 38
 39
 40
 41
 
 | <?php           
 
//	echo "Fichier à écrire : ".$cible;
 
	if ($_FILES['fichier']['error']) {     
		  switch ($_FILES['fichier']['error']){     
			   case 1: // UPLOAD_ERR_INI_SIZE     
				   echo"Le fichier dépasse la limite autorisée par le serveur (fichier php.ini) !";     
				   break;     
			   case 2: // UPLOAD_ERR_FORM_SIZE     
				   echo "Le fichier dépasse la limite autorisée dans le formulaire HTML !"; 
				   break;     
			   case 3: // UPLOAD_ERR_PARTIAL     
				   echo "L'envoi du fichier a été interrompu pendant le transfert !";     
				   break;     
			   case 4: // UPLOAD_ERR_NO_FILE     
				   echo "Le fichier que vous avez envoyé a une taille nulle !"; 
				   break;     
		  }     
	}     
	else {     
		 // $_FILES['nom_du_fichier']['error'] vaut 0 soit UPLOAD_ERR_OK     
		 // ce qui signifie qu'il n'y a eu aucune erreur   
		 $cible="c:\\tmp\\test.jpg";
		print  $_FILES['fichier']['name']."</br>";
		print  $_FILES['fichier']['size']."</br>";
		print  $_FILES['fichier']['type']."</br>";
		print  $_FILES['fichier']['tmp_name']."</br>";
 
		$source=$_FILES['fichier']['tmp_name'];
		if (!copy($source, $cible)) {
			echo "ERREUR : La copie du fichier ".$cible." a échoué...\n";
		}
 
 
		 copy($_FILES['fichier']['tmp_name'],$cible);
		 echo "La copie du fichier ".$cible." a réussi...\n";
 
 
	}     
?> | 
 Celui ci fonctionne, je l'ai testé. 
Lorsque je lance avec cURL, 
	
	C:\wamp\www\PhpMarc>curl http://localhost/PhpMarc/FormulaireSelectionneRepertoire.php
 Le résultat est le suivant 
	
	| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 
 | <?xml version="1.0" encoding="UTF-8"?>
´╗┐<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/T
R/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
 <head>
  <title>Formulaire d'upload</title>
 </head>
 <body>
  <form method="post" enctype="multipart/form-data" action="upload.php">
   <p>
    <label>Sélectionnez un répertoire :
    <-- <input type="dirname" name="repertoire" /> -->
        <input type="file" name="fichier" />
    </label>
   </p>
   <p><input type="submit" value="Envoyer" /></p>
  </form>
 </body>
</html> | 
 
Il m'affiche le contenu du script au lieu de l'exécuter...
A plus tard.
Marco.
						
					
Partager