Précédent   Forum des professionnels en informatique > PHP > Langage > Fichiers
Fichiers Forum d'entraide sur les fichiers avec PHP. Avant de poster -> FAQ fichiers et Sources fichiers
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 15/11/2007, 23h10   #1
Membre habitué
 
Inscription : janvier 2007
Messages : 201
Détails du profil
Informations personnelles :
Âge : 67

Informations forums :
Inscription : janvier 2007
Messages : 201
Points : 118
Points : 118
Par défaut [Upload] Comment récupérer un fichier ?

Bonjour à toutes et à tous,
Je n'arrive pas à recuperer l'input file :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Title here!</title>
</head>
<body>
<form enctype="multipart/form-data" action="testgfile.php" method="post">
<br>
Input :
<input name="fic" type="file" size="64">
<br>
<input type="submit">
<br>
</form>
</body>
</html>
Avec le code PHP suivant :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Test Post File</title>
</head>
<body>
<?php
$z=$_POST["fic"];
print("<br>");
print("Erreur : ");
print($_FILES["fic"]["error"]);
print("<br>");
print($z);
?>
</body>
</html>
J'ai bien zéro dans $_files["fic"]["error"], mais nada dans $z.
Merci de votre aide
belocom est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/11/2007, 23h19   #2
En attente de confirmation mail
 
Inscription : juin 2002
Messages : 6 164
Détails du profil
Informations forums :
Inscription : juin 2002
Messages : 6 164
Points : 6 404
Points : 6 404
Les informations relatives aux fichiers uploadés ne se trouvent pas dans le tableau $_POST mais $_FILES. Vous devriez consulter le tutoriel : Upload de fichiers en PHP avant d'aller plus loin
julp est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/11/2007, 19h15   #3
Membre habitué
 
Inscription : janvier 2007
Messages : 201
Détails du profil
Informations personnelles :
Âge : 67

Informations forums :
Inscription : janvier 2007
Messages : 201
Points : 118
Points : 118
Merci, j'y courre.
Epatant, je sais faire miantenant :
Code :
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
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Test Post File</title>
</head>
<body>
<?php
print("<br>");
print("Erreur : ");
print($_FILES["fic"]["error"]);
print("<br>");
if (move_uploaded_file($_FILES['fic']['tmp_name'], 'Uploaded.zzz')) {
       echo 'Upload effectué avec succès !';
     }
     else //Sinon (la fonction renvoie FALSE).
     {
          echo 'Echec de l\'upload !';
     }	
 
 
?>
<?php
?>
 
</body>
</html>
belocom est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 10h53.


 
 
 
 
Partenaires

Hébergement Web