[BNM] PHP help - check directory for file

Sebastian von Bischopink lists at allaboutseb.com
Mon Nov 20 17:08:59 GMT 2006


Thanks David, that's what i needed!

Have a nice evening,

Seb


On 20 Nov 2006, at 15:29, David Stone wrote:

> $siteUrl = 'http://yoursite.com/pdfs/';
> $path = '/var/www/yoursite.com/httpdocs/pdfs/';
> $fileName = 'yourFile.pdf';
>
> if (is_file($path.$fileName))
> {
> 	echo '<a href="'.$siteUrl.$fileName.'">'.$fileName.'</a>;
> }
>
> --  
> David Stone
>
> w: http://www.builtbydave.co.uk/
> m: +44 (0)7908 257349
> t: +44 (0)1273 776180
>
> skype: builtbydave / aim: 21261698 / msn: same as email
>
>
> Sebastian von Bischopink wrote:
>> Hi BNM,
>>
>> I am in need of a small php-script that allows me to check in a
>> specific directory
>> on the server whether a .pdf file is present or not. If a pdf file is
>> found, the script
>> should echo a link to the file. Else it should not display anything.
>>
>> I reckon this should be pretty straight forward using opendir/readdir
>> and an if/else statement,
>> but then i am not a php coder. So any help would be greatly  
>> appreciated.
>>
>> Thanks in advance,
>>
>> Seb
>>
>>
>>
>>
>>
>
> -- 
>
> BNM info/subscription/archives: http://www.brightonnewmedia.org/
>
> BNM archive search: http://www.roddis.org/bnm/search.php
> BNM Del.icio.us tag: http://del.icio.us/tag/bnm/
> BNM Flickr group: http://www.flickr.com/groups/bnm/
>
> BNM powered by http://www.screen-play.net/




More information about the BNMList mailing list
BNMList is hosted by Screenlists, a Screen-Play.net service