RSS

Forum | How to hide the path of my downloads folder in my html

You must be logged in to post
Search Forums:


 






How to hide the path of my downloads folder in my html

UserPost

6:54 AM
Feb 28, 2010


coollew

Member

posts 34

1

I'm working on a project for myself and will be offering downloads.

I would like to hide or redirect the path to the folder containing the zip files (should I be concerned of this? I think so). Any help would be greatly appreciated.Cool

2:44 PM
Apr 27, 2010


Bilal

New Member

posts 1

2

No need to hide the path, it is not difficult to guess anyway once the download starts.


Add to your .htaccess the following code: 

Options -Indexes

It prevents directory listings for URLs which map to a directory. Of course you can also add a blank "index.html" to your zip directory.

—–

Bilal

5:55 AM
May 5, 2010


tomw

Member

posts 74

3

You can hide the path with this simple script:


<?php
// Path and name of file
$file = "./designs/coollew/bamboo.zip";
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
// you can use any name, the extension should match file type
header("Content-Disposition: attachment; filename=CoolLew_Bamboo.zip");
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
?>

See example

As you can see, it will be difficult to guess the actual path.


Here you can get the file from a remote site.

<?php
// get data from remote site
$data = file_get_contents("http://www.yoururlhere.com/file.zip&quot ;) ;
$fp = fopen("tmp.zip","w");
fwrite($fp, $data);
fclose($fp);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
// you can use any name, the extension should match file type
header("Content-Disposition: attachment; filename=CoolLew_vacation.zip");
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize("tmp.zip"));
ob_clean();
flush();
readfile("tmp.zip");
?>

There is no way you can guess the actual path.

See example