Hi,
I'm using the following line to download a file:
header("Location: " . $downloadfile );
How can I hide the URL so the user doesn't know where the file is located on my website?
Thanks!
Hide URL to send file
Moderator: General Moderators
Not sure if you can really hide it. If it is a file, such as a movie file, or somthing that can't be viewed via browser, maybe you could do something like:
download.php?file=4
and on the page use a variable like
if($file == 4) {
header("Location: " . $downloadfile );
}
Something like that. Just thinking out load. Maybe it will jar an idea...
Tim
download.php?file=4
and on the page use a variable like
if($file == 4) {
header("Location: " . $downloadfile );
}
Something like that. Just thinking out load. Maybe it will jar an idea...
Tim
- greenhorn666
- Forum Commoner
- Posts: 87
- Joined: Thu Aug 14, 2003 7:14 am
- Location: Brussels, Belgium
You can pass the file to the client thru a php script:
You can marry HTML output and join the file too, but not quite sure how, you'll have to look this one up (or lynx -dump -head http://www.whatever-site.com/does/it/how/you/want/url on unices)
Code: Select all
// Set the content type (we assume PDF here...)
header("Content-type: application/pdf");
// And set a name for the file
header("Content-disposition: attachment; filename=".basename($file));
// open the file
$fp = fopen($file);
// pass its content thru
fpassthru($fp);
// close the file
fclose($fp);