<?php
function send_header () {
print "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">";
print "<html>";
print "<head>";
print " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">";
print "<META HTTP-EQU=\"pragma\" CONTENT=\"no-cache\"> ";
print "<META HTTP-EQU=\"Cache-Control\" CONTENT=\"no-cache\"> ";
print "<META HTTP-EQUIV=\"Expires\" CONTENT=\"Tue, 20 Aug 1996 14:25:27 GMT\"> ";
print " <meta name=\"Generator\" content=\"Microsoft Word 97\">";
print " <meta name=\"Template\" content=\"C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot\">";
print " <meta name=\"GENERATOR\" content=\"Mozilla/4.7 [en] (Win98; I) [Netscape]\">";
print " <title>test</title>";
print "</head>";
print "<body link=\"#0000FF\" vlink=\"#800080\">";
}
function send_footder () {
print "</body>";
print "</html>";
}
if (!$_POST["FILE"]) {
send_header();
?>
<form action="<?php $_SERVER["PHP_SELF"]?>" method="post" name="formulaire">
<?php
if ($dh = opendir(".")) {
echo "<SELECT NAME=FILE>";
while (($file = readdir($dh)) !== false) {
//echo "fichier : $file : type : " . filetype($dir . $file) . "\n";
echo "<OPTION>$file</OPTION>";
}
closedir($dh);
echo "</SELECT>";
echo "<BR>";
echo "<INPUT TYPE=SUBMIT>";
}
?>
</form>
<?php
send_footder();
}
else {
$FILE=$_POST["FILE"];
$extension=strrchr($FILE,'.');
//send_header();
//echo "<BR> Il faut afficher ".$FILE."<BR>";
switch ($extension) {
case ".xls" :
$app="vnd.ms-excel";
//echo "fichier excel";
break;
case ".pps" :
$app="vnd.ms-powerpoint";
//echo "fichier powerpoint";
break;
case ".doc" :
$app="msword";
//echo "fichier word";
break;
default :
//echo "fichier de type inconnu";
break;
}
if ($app != "") {
header ("Content-type: application/".$app);
readfile($FILE);
}
else {
send_header();
echo "Le document : ".$FILE." est de type inconnu...";
send_footder();
}
//send_footder();
}
?>
header("content-type: application/zip");
//header("Content-Disposition: inline; filename=selection.zip"); //force le téléchargement
header("Content-Disposition: attachment; filename=selection.zip"); //laisse le choix à l'utilisateur
header("Content-Transfer-Encoding: binary");
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header("Expires: 0");
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename=doc.pdf');
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header('Pragma: anytextexeptno-cache', true);
header('Cache-control: private');
header('Expires: 0');
De toute facon, les composants COM te permettent d'utiliser les logiciels sur le serveur, pas sur le client...ps : j'ai donc abandonné les composants COM