The only problem is when you hit the download link, it gives away the path to the file, which I'd rather it didn't do, for security reasons, is there anyway I can change this, even if it's just to a random string of numbers?
HTML
<a href="#" onclick="downloadFile();">Download</a> <!-- A little later on --> <iframe id="downloadFrame" style="display:none"></iframe>
Javascript:
function downloadFile()
{
var iframe = document.getElementById('downloadFrame');
var path = 'path/to/file';
iframe.src = "download.php?path="+path;
}
PHP (download.php):
<?php
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$_GET['path']);
readfile($_GET['path']);
?>
Just to remind you, when you hit download, the name of the file downloaded is the path to the file (with all "/" replaced with "_") can I sort this?
Thanks in advance for your help!

New Topic/Question
Reply




MultiQuote




|