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 Rich on 05/26/06 20:13

On 26 May 2006 07:36:30 -0700, wylbur37 wrote...
>
>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. However, if I
>RIGHT-click on it and select "Copy link location" (which copies the
>URL to the clipboard) and then paste the URL into the address bar of
>the browser, the picture then displays correctly.
>
>Why did it not work when I clicked on the link the first time, but it
>only worked when I pasted the link to the address bar?
>
>Is there some special notation/syntax that I need to use to get this
>to work properly?
>


Not sure if this is a factor but your forward slashes should be back slashes,
since Microsoft does them backwards on their file system. If "\pictures\" is
outside your document root, that may create problems with the web server being
able to locate the file.

C:\pictures\xyz.jpg

Since "file://" URLs point to your local file system, there's probably some
basic security limits to prevent a hypertext link from loading or accessing
files/programs on your PC.

Rich
--
Unlimited Newsgroup Downloads / $19.95 month
More Details - http://newsguy.com/overview.htm

 

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

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