Bonjour,
Je souhaite mettre en place un transfert automatique d'images du local sur le serveur, à l'aide d'un input type="file".
J'ai fait ceci:
Puis dans le deuxième fichier:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <form ENCTYPE="multipart/form-data" action="index2.php" method="post" name="form1" id="form1" onsubmit="return verification()"> ... <tr> <td bgcolor="#F2F2F2" class="Style6">Photo ligne produit<br /> </td> <td bgcolor="#F2F2F2" class="Style13"><input type="file" value="" name="imgmini" id="imgmini" size="30" /></td> </tr> <tr> <td class="Style6">Photo page produit</td> <td class="Style13"><input type="file" value="" name="imgprod" id="imgprod" size="30" /></td> </tr> ... </form>
Mais ca ne marche pas.
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 $nomDestination=$_FILES["imgmini"]["name"]; if (copy($_FILES['imgmini']['tmp_name'], "http://www.mon-cheval.fr/httpdocs/images/produits/$nomDestination")) { echo("<B>Fichier $nomDestination copié avec succès</B>"); } else { echo("<B>La copie du fichier $nomDestination a échoué...</B>"); } @unlink($_FILES["imgmini"]["tmp_name"]); $nomDestination2=$_FILES["imgprod"]["name"]; if (copy($_FILES['imgprod']['tmp_name'], "http://www.mon-cheval.fr/httpdocs/images/produits/$nomDestination")) { echo("<B>Fichier $nomDestination2 copié avec succès</B>"); } else { echo("<B>La copie du fichier $nomDestination2 a échoué...</B>"); } @unlink($_FILES["imgprod"]["tmp_name"]);
Voici l'erreur qu'on me renvoi:
Quelqu'un pourrait me dire pourquoi?Warning: copy(http://www.mon-cheval.fr/httpdocs/im...102003009V.jpg) [function.copy]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/vhosts/mon-cheval.fr/subdomains/admin/httpdocs/l/md4.php on line 60
La copie du fichier 0102003009V.jpg a échoué...
Warning: copy(http://www.mon-cheval.fr/httpdocs/im...102003009V.jpg) [function.copy]: failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/vhosts/mon-cheval.fr/subdomains/admin/httpdocs/l/md4.php on line 71
La copie du fichier 0102003009.jpg a échoué...
Je ne vois pas ce qui ne va pas...
Peut etre les droit du repertoire?
Ce n'est qu'une hypothèse...
Partager