BOnjour , j'ai un souci , je veux récupérer le nom d'un fichier uploadé par un formulaire.
Ca marchait très bien avant mais il me génére cet erreur maintenant:
Notice: Undefined index: file1 in c:\program files\easyphp1-8\www\recupfiletest.php on line 12
Contenu du fichier essai2.php :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
34
35
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 
 
<title>Untitled Document</title>
</head>
 
<body>
 
 
<?php
 
 
echo"
<form name='form1' action='recupfiletest.php' method='post'   onsubmit='return validation();'>

  <table border='1' cellpadding='3' cellspacing='1' align='center'  >
<tr><th>
<input type='file'  name='file1'  size='20'></th></tr> 

<TR><th ALIGN='center'  COLSPAN=2><font size='5'>
<p align='center'> <input class='button' type='submit' value='Valider' style='font:Verdana,Helvetica;font-size: 17px;background-color:#FFFFFF;color: #3B46BF;'> 
<input class='button' type='reset' value='Effacer' style='font:Verdana,Helvetica;font-size: 17px;background-color:#FFFFFF;color: #3B46BF;'> </p>
</table>

</form>";
?>
 
 
</body>
</html>

Contenu du fichier qui récupère le formulaire recupfiletest.php :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
 
<body>
 
<?php
echo $_FILES['file1']['name'];  // line12
?>
</body>
</html>


J'ai pourtant bien utilisé le nom du champ file1 .

Merci