bonjour
j'ai 2 fichiers pour le upload d'un fichier .DOC
le 1er fichier php c'est celui du formulaire
upload_form.php
le 2eme fichier upload.php (le code de upload)
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 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table width="600" border="1" align="center" bgcolor="#FFFFFF"> <tr> <th scope="row"><form method="POST" action="upload.php" enctype="multipart/form-data"> <p> </p> <p> <input type="hidden" name="MAX_FILE_SIZE" value="2500000"> <input type="file" name="devoir"> <input type="submit" name="envoyer" value="Envoyer le fichier"> <a href="http://www.onefd.edu.dz/html/devoirs.php"> <input name="mot_pass" type="hidden" id="mot_pass" value="<? echo $_POST['mot_pass']; ?>" /> <input name="num_ins" type="hidden" id="num_ins2" value="<? echo $_POST['num_ins']; ?>" /> </a></p> <p> </p> </form></th> </tr> </table> </body> </html>
le upload foctionne bien mais aprés que l'eleve fait le upload il ya un 3eme fichier qui doit s'afficher(c'est un accusé de l'upload).
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-color: #000066; } --> </style></head> <body> <?php if ($_GET) {$num_ins= $_GET['num_ins']; $mot_pass= $_GET['mot_pass']; } else if ($_POST) {$num_ins= $_POST['num_ins']; $mot_pass= $_POST['mot_pass']; } if (isset ($num_ins)==FALSE) { ?> <p> <script language="javascript"> <!-- //document.bgColor = "red"; --> document.location = "gad_aut_etud.php"; </script> <? exit(); } ?> </p> <p> </p> <? if(isset($_FILES['devoir'])) { $dossier = 'Gad_etud_rep/'; $fichier = basename($_FILES['devoir']['name']); /////////////////////////// $taille_maxi = 2500000; // taille maxi du document upload $taille = filesize($_FILES['devoir']['tmp_name']); $extensions = array('.doc'); $extension = strrchr($_FILES['devoir']['name'], '.'); ////////////////// //Début des vérifications de sécurité... if(!in_array($extension, $extensions)) //Si l'extension n'est pas dans le tableau { ?> <script language="javascript"> alert('Vous devez uploader un fichier de type doc') ; document.location= "upload.php?num_ins=<?php echo $num_ins;?>&mot_pass=<?php echo $mot_pass;?> "; </script> <? } if($taille>$taille_maxi) { ?> <script language="javascript"> alert('Le fichier est trop gros...') ; document.location= "upload.php?num_ins=<?php echo $num_ins;?>"; </script> <? } if(!isset($erreur1)) //S'il n'y a pas d'erreur, on upload {if(!isset($erreur2)) { if(move_uploaded_file($_FILES['devoir']['tmp_name'], $dossier . $fichier)) //Si la fonction renvoie TRUE, c'est que ça a fonctionné... { ?><form action="etud_acuse_upload.php" method="post" name="form1" target="_blank"> </form> <p> <script language="javascript"> alert('Upload effectué avec succès !') ; document.form1.submit(); </script> <? } else //Sinon (la fonction renvoie FALSE). { ?> // <script language="javascript"> alert('Echec de l\'upload !') ; document.location= "upload.php"; </script> <? } }//if(!isset($erreur1)) }//if(!isset($erreur2)) }//if(isset($_FILES['devoir'])) ?> </p> <p> </p> </body> </html>
etude_accuse_upload.php
ma question comment je pضsse les paramettres
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>شهادة إثبات نقل الملف</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_callJS(jsStr) { //v2.0 return eval(jsStr) } //--> </script> <style type="text/css"> <!-- body { background-color: #004080; } .Style41 {font-size: 13px; color: #000000; } .Style42 { font-size: xx-large; font-weight: bold; color: #000000; } --> </style> </head> <body onLoad="MM_callJS('window.print();')"> <table border="1" align="center" bgcolor="#FFFFFF"> <tr> <td width="627" height="329"> <div align="center"> <table width="611" border="0"> <tr> <td width="105"><div align="center"></div></td> <td width="371"><div align="center"><strong></strong></div></td> <td width="121"><div align="right"></div></td> </tr> </table> <p class="Style42"><U>Accusé</U></p> <form name="form1" method="post" action="upload.php"> <table width="431" border="1"> <tr> <th width="301" scope="row"><div align="right"></div> <div align="right"><?php echo $num_ins?></div></th> <td width="114"><div align="right"><strong>numero inscription </strong></div></td> </tr> <tr> <th scope="row"><div align="right"></div> <div align="right"><?php echo ($_FILES['devoir']['name']);?></div></th> <td><div align="right"><strong>nom de fichier </strong></div></td> </tr> <tr> <th scope="row"><div align="right"></div> <div align="right"></div></th> <td> </td> </tr> <tr> <th scope="row"><div align="right"></div> <div align="right"></div></th> <td> </td> </tr> <tr> <th scope="row"><div align="right"></div> <div align="right"></div></th> <td> </td> </tr> </table> <p class="Style42"><u><a href="http://www.onefd.edu.dz/html/devoirs.php"> <input name="mot_pass" type="hidden" id="mot_pass2" value="<? echo $_POST['mot_pass']; ?>" /> <input name="num_ins" type="hidden" id="num_ins2" value="<? echo $_POST['num_ins']; ?>" /> </a></u></p> <p class="Style42"> </p> </form> <p class="Style42"><u><a href="http://www.onefd.edu.dz/html/devoirs.php"> </a></u></p> <p class="Style42"> </p> </div></td> </tr> </table> </body> </html>
numero d'inscription (num_ins) et le nom du fichier pour les afficher dans le 3eme fichier.
merci
Partager