BOnjour,

à partir d'un formulaire je veux enregistrer les photos des utilisateurs mais ça ne marche pas et je ne vois pas pourquoi, voisi mon code :

(le reste du formulaire fonctionne très bien)

formulaire.html :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
		<tr>
			<td style="text-align:right; width:20%"><?php echo "photo";?>&nbsp;</td>
			<td  style="width:80%"><input type="file" name="photo" /><br /></td>
		</tr>
formulaire.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
 
  if (isset($_FILES['photo']) AND $_FILES['photo']['error'] == 0){
 
        if ($_FILES['photo']['size'] <= 1000000){
 
                $infosfichier = pathinfo($_FILES['photo']['name']);
                $extension_upload = $infosfichier['extension'];
                $extensions_autorisees = array('jpg', 'jpeg', 'gif', 'png');
                  if (in_array($extension_upload, $extensions_autorisees)){
                        move_uploaded_file($_FILES['photo']['tmp_name'], '/components/com_misterestate/pictures/' . basename($_FILES['photo']['name']));
                        echo "L'envoi a bien été effectué !";
                }
 
 
        }
        else
        {
          echo "fichier trop gros";
        }
 
  }
Merci d'avance