You are here: Re: checking for a file « HTML « IT news, forums, messages
Re: checking for a file

Posted by Martin Jay on 05/19/06 19:39

In message <2IKdnetQhNV1cfDZRVn-qA@comcast.com>, Eric <nospam@email.com>
writes
>Martin Jay wrote:
>> In message <fa6dnfXtqdyC1ffZ4p2dnA@comcast.com>, Eric <nospam@email.com>
>> writes
>>>Is it possible to check for existence of a file from a web page using
>>>javascript? I am trying to come up with a routine that i can call from the
>>>rest of my javascript code that will check if a particular file exists on
>>>disk at the server. ie bool FileExists("http://myServer.com/File.gif");
>>>Any ideas on how to do this?

>> I cannot think of a way to achieve this.
>>
>> You could, however, include a list of filenames in your Javascript, and
>> then simply check it to see whether a particular file exists.
>>
>> There are some problems, though:
>>
>> you may not wish to give visitors a list of all the files;
>>
>> the list may be rather long;
>>
>> and it might be a pain keeping the list up-to-date. :(
>>
>> Does your host offer server side scripting, such as PHP or Perl? That's
>> probably the best solution.

>Yes, but HOW? do you determine a file is there? I'm not looking for unknown
>files, I'm looking for a very specific filename.
>Eric

From the PHP manual:

<?php
$filename = '/path/to/foo.txt';

if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
?>
--
Martin Jay

 

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

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