Page 1 of 1

Avoid the actual path to appear

Posted: Mon Jul 31, 2006 12:21 am
by seema
Everah | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi, when i want to view/download the file the actual path appears at the url , how can i avoid this.

below is the code that i'm using

Code: Select all

if (file_exists($file_path_csv)) {

		if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)
		{
			header("Location: ".$file_path_csv);
		}
		else
		{

			$len = filesize($file_path_csv);
			header("Content-Description: File Transfer");
			header('Content-type: application/octet-stream');
			header('Content-Disposition: attachment; filename="'.$list.'"');
			header("Content-Transfer-Encoding: binary");
			header("Content-Length: ".$len);
			readfile(''.$file_path_csv.'');
		}

	}

Everah | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon Jul 31, 2006 12:36 am
by RobertGonzalez
You could try mod_rewrite to hide your visible URLs.

Posted: Mon Jul 31, 2006 12:51 am
by timvw
Instead of using $file_path_csv you could use md5($file_path_csv) but in that case you'd better have LUT (look up table) that contains all the pairs of paths and checksums... Or you write your own mapping mechanism...