bonjour à tous!

je voudrais pouvoir uploader un fichier dans un répertoire que j'ai créer a l'avance voici mon code en php pour effectuer le transfère:

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
 
<?php
// Testons si le fichier a bien été envoyé et s'il n'y a pas d'erreur
if (isset($_FILES['monfichier']) AND $_FILES['monfichier']['error'] == 0)
{
        // Testons si le fichier n'est pas trop gros
        if ($_FILES['monfichier']['size'] <= 1000000)
        {
                // Testons si l'extension est autorisée
                $infosfichier = pathinfo($_FILES['monfichier']['name']);
                $extension_upload = $infosfichier['extension'];
                $extensions_autorisees = array('jpg', 'jpeg', 'gif', 'png');
                if (in_array($extension_upload, $extensions_autorisees))
                {
                        // On peut valider le fichier et le stocker définitivement
                        move_uploaded_file($_FILES['monfichier']['tmp_name'], 'D:/TRAVAIL/hamza projet/EasyPHP1-8-ModGSI/www/CLN/Mozilla/galerie/' . basename($_FILES['monfichier']['name']));
                        echo "L'envoi a bien été effectué !";
                }
        }
}
?>
ici mon en html:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
<form action="ajout_image1.php" method="post" enctype="multipart/form-data">
        <p>
                Formulaire d'envoi de fichier :<br />
                <input type="file" name="monfichier" /><br />
                <input type="submit" value="Envoyer le fichier" />
        </p>
</form>
Mais malgré tout j'ai cette erreur qui s'affiche:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
Warning: move_uploaded_file(D:/TRAVAIL/hamza projet/EasyPHP1-8-ModGSI/www/CLN/Mozilla/galerie/25.jpg): failed to open stream: No such file or directory in d:\travail\hamza_projet\easyphp1-8-modgsi\www\cln\mozilla\test ulpload test\ajout_image1.php on line 15
 
Warning: move_uploaded_file(): Unable to move 'D:/TRAVAIL/hamza_projet/EasyPHP1-8-ModGSI\tmp\php1054.tmp' to 'D:/TRAVAIL/hamza projet/EasyPHP1-8-ModGSI/www/CLN/Mozilla/galerie/25.jpg' in d:\travail\hamza_projet\easyphp1-8-modgsi\www\cln\mozilla\test ulpload test\ajout_image1.php on line 15
Merci d'avance