I have a small problem
Posted: Tue Apr 27, 2010 7:56 pm
Hello,
I don't know where is the problem in this script
1.html :
download.php :
test.html
when I enter 'test.html' in the text field I can't download the file test.html'
thank you for your help.
I don't know where is the problem in this script
1.html :
Code: Select all
<html><body>
<form method="post" action="download.php">
File name: <input type="text" name="FN" size="12"><br>
<input type="submit" value="OK">
</form></body></html>Code: Select all
<?php
$file = $FN;
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>Code: Select all
TESTthank you for your help.