script de telechargement en php
Posté : 01 déc. 2006, 13:48
slt à tous,un petit pb avc ce script:
dans mon fichier index.php
<object declare id="game_1" data="download.php?dl=net1.doc"type="application/x-doc" declare> </object >
<a href="index.php" idoc="#game_1">net1.doc</a><br>
et dans mon fichier download.php
<?php
$dl = basename($dl);
header('Content-Type: application/octet-stream');
header('Content-Length: '.filesize($dl));
header('Content-Disposition: attachment; filename="'.$dl.'"');
readfile($dl);
?>
dans mon fichier index.php
<object declare id="game_1" data="download.php?dl=net1.doc"type="application/x-doc" declare> </object >
<a href="index.php" idoc="#game_1">net1.doc</a><br>
et dans mon fichier download.php
<?php
$dl = basename($dl);
header('Content-Type: application/octet-stream');
header('Content-Length: '.filesize($dl));
header('Content-Disposition: attachment; filename="'.$dl.'"');
readfile($dl);
?>