You are here: Re: Clickable File Link in PHP « PHP Programming Language « IT news, forums, messages
Re: Clickable File Link in PHP

Posted by Lars Eighner on 10/09/07 17:09

In our last episode, <xn0fc8zbu1j3b5e002@news.individual.net>, the lovely
and talented Jeff Gaines broadcast on comp.lang.php:

> I have spent the day learning how to use Zend Development Environment. I
> can now produce a list of files in a directory, filtered by extension, and
> apparently clickable. Unfortunately clicking on them in a browser doesn't
> take me to the file link.

> I have found examples for clickable URL's, FTP links and mailto addresses
> but not files. I am managing to produce output like this:

><a href="file:///E:/wwwroot/Test/NewListing.php">NewListing.php</a>
><br>
><a href="file:///E:/wwwroot/Test/Public DNS.htm">Public DNS.htm</a>
><br>
><a href="file:///E:/wwwroot/Test/TestList.php">TestList.php</a>
><br>
><a href="file:///E:/wwwroot/Test/Usenet.htm">Usenet.htm</a>

> They look fine in a browser (running on Localhost) but I get nowhere
> clicking them. If I copy the output from Zend and paste it into an editor
> then save it as an html file the links all work fine so the output seems
> to be in the correct format.

> The examples I found all work so I am coming to the conclusion that either
> clickable file links are not possible or I am missing something obvious.

> Can anybody give me a steer on this? I want clickable file links rather
> than just navigating to a folder so I can control what files are shown
> (i.e. just file.html not file.html and the file files directory).

I sugget you try to navigate to the files with your browser alone. Bookmark
one of them and then see if your corresponding link looks exactly like the
bookmark.

Although I haven't the foggiest idea how permissions in Windows work (if at
all), if your browser cannot navigate to a file, it's almost a sure bet that
it cannot follow a link to the same file.

It seems barely possible that a Windows browser (i.e. IE) has a weird
interpretation of file urls, such as, maybe, requiring backslashes in file
path part.

It may be that files with spaces require url encoding (ie. <space> = %20 ).
That obviously is not your problem now because you are failing on files
without spaces in their names.

Anyway, when you see what your browser thinks a bookmark to the file should
look like, you know what a link it can follow should look like.

--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 468 days to go.
What do you do when you're debranded?

 

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

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