Bonjour,
J'ai développé une petite fonction qui me permet de déposer des fichiers sur un serveur, puis de les récupérer par la suite.
Pour cela j'utilise Wamp Serveur. J'ai modifier les fichiers de config httpd.conf et php.ini afin de pouvoir déposer des fichiers d'une taille maximal de 500Mo.
Jusque là pas le moindre soucis.
Lorsque je souhaite récupérer un fichier, d'une faible taille pas de soucis, en revanche dès que celui-ci dépasse la centaine de méga octets, cela ne fonctionne plus. Le navigateur m'indique que le fichier ne pèse que 1Ko...
Voici le code de mon fichier php pour le download :
Je suis donc complètement bloqué. J'espère que vous pourrez m'aider.
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 <?php if (isSet($_POST['pwd'])) { $mdp = $_POST['pwd']; $mdp_md5 = md5($mdp); mysql_connect("localhost", "root", ""); mysql_select_db("Upload"); $query = mysql_query("SELECT lien,Nom_final,BoolSuppr FROM link WHERE pwd='$mdp_md5'") or die(mysql_error()); if(!mysql_num_rows($query)) { echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; echo "<head>"; echo "<meta http-equiv=\"Content-Type\" content=\"html/css; charset=utf-8\" />"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"./design.css\" title=\"default\" media=\"screen\" />"; echo "</meta>"; echo "</head>"; echo "<body>"; echo "<h1>Attention, le mot de passe saisi est incorrect !<span></span></h1>"; echo "<div class=\"liens2\">"; echo "<a href=\"./\">Essayez à nouveau</a><br><br></div>"; echo "</div>"; echo "</body>"; echo "</html>"; } else { while ($donnees = mysql_fetch_array($query)) { if($donnees['BoolSuppr'] == "0") { mysql_query("UPDATE link set Count = Count + 1 WHERE pwd = '$mdp_md5'") or die(mysql_error()); header('Content-Transfer-Encoding: binary'); //Transfert en binaire (fichier) header("Content-Type: application/force-download"); header('Content-Disposition: attachment; filename="'.$donnees["Nom_final"].'"'); //Nom du fichier readfile($donnees['lien']); } else { echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; echo "<head>"; echo "<meta http-equiv=\"Content-Type\" content=\"html/css; charset=utf-8\" />"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"./design.css\" title=\"default\" media=\"screen\" />"; echo "</meta>"; echo "</head>"; echo "<body>"; echo "<h1>Attention, le fichier que vous tentez de telecharger a ete supprimer !<span></span></h1>"; echo "<div class=\"liens2\">"; echo "<a href=\"./\">Essayez à nouveau</a><br><br></div>"; echo "</div>"; echo "</body>"; echo "</html>"; } } } } else { echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; echo "<head>"; echo "<meta http-equiv=\"Content-Type\" content=\"html/css; charset=utf-8\" />"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"./design.css\" title=\"default\" media=\"screen\" />"; echo "<title>Css</title>"; echo "</meta>"; echo "</head>"; echo "<body>"; echo "<h1>Attention, le mot de passe saisi est incorrect !<span></span></h1>"; echo "</div>"; echo "</body>"; echo "</html>"; } ?>
Partager