Wysyłanie plików do klienta z serwera..
<?php
$filePath = “nazwa katalogu”; // np: pliki/
$fileName = “nazwa pliku”; // np. program.exe
$fd = fopen($filePath.$fileName,“r”);
$size = filesize($filePath.$fileName);
$contents = fread($fd, filesize($filePath.$fileName));
fclose($fd);
header(“Content-Type: application/octet-stream”);
header(“Content-Length: $size;”);
header(“Content-Disposition: attachment; filename=$fileName”);
echo $contents;
?>
skrypt nr.2
<?PHP
$filePath = "nazwa katalogu"; // np: pliki/
$fileName = "nazwa pliku"; // np. program.exe
$fd = fopen($filePath.$fileName,"r");
$size = filesize($filePath.$fileName);
$contents = fread($fd, filesize($filePath.$fileName));
fclose($fd);
header("Content-Type: application/octet-stream");
header("Content-Length: $size;");
header("Content-Disposition: attachment; filename=$fileName");
echo $contents;
?>