PHP-Code:
<?php
function send_file($name) {
$status = FALSE;
$path = "c:/server/verwaltung/".$name;
if (!is_file($path) or connection_status()!=0) return(FALSE);
header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2, date("i"),
date("s"), date("m"), date("d"), date("Y")))." GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: application/msword\n");
header("Content-Disposition: filename=\"".$name."\"\n");
header("Content-length: ".(filesize($path))."\n");
if ($file = fopen($path, 'rb')) {
$data = fread($file, filesize($path));
fclose($file);
echo $data;
}
}
?>
<?php
if (!send_file("Dienstauftrag.doc")) {
die ("file transfer failed");
// either the file transfer was incomplete
// or the file was not found
} else {
// the download was a success
// log, or do whatever else
}
?>
Kommentar