You are here: Re: PHP-generated link to local file doesn't work when clicked on. Why? « All PHP « IT news, forums, messages
Re: PHP-generated link to local file doesn't work when clicked on. Why?

Posted by Chuck Anderson on 05/26/06 23:30

Martin Jay wrote:
> In message <1148654190.083042.204000@i40g2000cwc.googlegroups.com>,
> wylbur37 <wylbur37nospam@yahoo.com> writes
>
>> I'm running an Apache server on my own computer (Windows XP Pro).
>>
>> I wrote a simple PHP script (called test3.php) that I'm running by
>> putting the following URL in the address bar of the browser (Firefox)
>> ...
>>
>> http://localhost/test3.php
>>
>> The script generates the following link using the echo statement ...
>>
>> <a href="file:///C:/pictures/xyz.jpg"> Picture </a>
>>
>> ("C:/pictures/xyz.jpg", as you can guess by now, is an image file on
>> my harddrive, but it's not in the document root).
>>
>> When I clicked on the link, nothing happened.
>>
>
> It's disabled for security reasons.
>
> There's more information about this at:
> <http://kb.mozillazine.org/Links_to_local_pages_don't_work>
>
Yes. And that page contains the following instructions for disabling a
preference in Firefox.

"Type about:config <http://kb.mozillazine.org/About:config> into the
Location bar and hit Enter. Find the entry for *security.checkloaduri*
and change its value to *false* by double-clicking it. Then, restart
your browser."

This is a possible security risk, though, so another solution is to add
an alias to Apache config file.

In httpd.conf, I have added:
Alias /cdrive/ "c:/"

Then, in Php scripts, when I want to access a local file I use:
http://localhost/cdrive/............

or

/cdrive/......

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Everyone's journey should be different,
so that we all are enriched
in new and endless ways
*****************************

 

Navigation:

[Reply to this 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

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