Bonjour
j'ai fait un script php qui affiche les fichiers d'un repertoire dans un tableau,
Quand je clique sur un fichier par exemple PDF il s'ouvre en pdf dans une page html
mais moi je veux quand je clique sur le fichier il me donne une fenetre de telechargement.

Comment faire ça SVP Veuillez m'aider
voila le script.
nom_dossier c'est le dossier qui contient les fichiers que je veux lister son contenu(il se trouve dans le meme chemin que le fichier fichier afficher_contenu.php


fichier afficher_contenu.php
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
 
<!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>
<?php 
$dirname = 'nom_dossier/';
$dir = opendir($dirname); 
?>
<table width="200" border="1" align="center">
  <tr>
    <td>num ins </td>
    <td>fil</td>
    <td>nom fil </td>
  </tr>
 
<?
while($file = readdir($dir)) {
    if($file != '.' && $file != '..' && !is_dir($dirname.$file))
    {
        ?>
         <tr>
    <td></td>
    <td>&nbsp;</td>
    <td><? echo '<a href="'.$dirname.$file.'">'.$file.'</a>'; ?></td>
  </tr>
        <?
 
 
    }
 
}
?>
    </table>
    <?
 
closedir($dir);
 
 
?>
</body>
</html>
 
<!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>
<?php 
$dirname = 'pdf/';
$dir = opendir($dirname); 
?>
<table width="200" border="1" align="center">
  <tr>
    <td>num ins </td>
    <td>fil</td>
    <td>nom fil </td>
  </tr>
 
<?
while($file = readdir($dir)) {
    if($file != '.' && $file != '..' && !is_dir($dirname.$file))
    {
        ?>
         <tr>
    <td></td>
    <td>&nbsp;</td>
    <td><? echo '<a href="'.$dirname.$file.'">'.$file.'</a>'; ?></td>
  </tr>
        <?
 
 
    }
 
}
?>
    </table>
    <?
 
closedir($dir);
 
 
?>
</body>
</html>