Reply to Re: Help with URl

Your name:

Reply:


Posted by Chuck Anderson on 09/14/06 04:51

undbund wrote:
> Hi, i have a pdf file located at the following location:
> http://www.somedomain.com/2006/members/news/somepdf.pdf
>
> I want to be able to access the same pdf from the same location but
> with the follwing url
>
> http://www.somedomain.com/2006/news/somepdf.pdf
>
> or
>
> http://www.somedomain.com/2006/news/view/somepdf.pdf
>
> where view is actually a php file view.php
>
> Notice that i have hidden the members directory!
>
> How can i achieve this, how can i (hide/add extra) certain sections of
> the url, to prevent the user from knowing the actual url from the
> address bar of the browser.
>
> Thanks
> undbund
>
>
For the second case, *and* if members is literally the name of the
directory, serve the file from view.php like so:

<?php

$file = $_SERVER'[PATH_INFO']
// in some cases it's ORIG_PATH_INFO - use phpinfo to take a look

// set the correct path here
$file = '/2006/members/news/' . $file;

header('Content-Description: File Transfer');
header('Content-Type: application/pdf');
header('Content-Length: ' . filesize($file));

// to download
header('Content-Disposition: attachment; filename=' . basename($file));

// to open in browser
// header('Content-Disposition: inline; filename=' . basename($file));

readfile($file);
?>


--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
*****************************

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация