Re: checking for a file
- From: Jonathan N. Little <lws4art@xxxxxxxxxxxxx>
- Date: Fri, 19 May 2006 18:36:53 -0400
In article <p-adneUqib3MYPDZRVn-tw@xxxxxxxxxxx>, nospam@xxxxxxxxx says...
Andy Dingley wrote:
Eric wrote:
Is it possible to check for existence of a file from a web page using
javascript?
No, it's impossible. It's forbidden by the sheer impossibiility of
accessing the server's filesystem from a remote web client, and by the
sandboxing that would obviously applied if such a feature were even
remotely feasible.
As to the client, then you're again sandboxed from looking around the
client's filesystem (and for good reason). There's a tiny amount that's
possible through manual file upload on a form, but that's hardly
directory listing.
I'm not trying to do a directory listng, I'm loading a series of images
(with specific filenames) in a loop, and if one is missing i want to break
out of the loop. So is that possible?
Eric
After and image loads it trips a onload event. I guess you *could* timed
loop (would require much tweaking to get it right) to test if the onload
had fired, if not load next image. Caveat, the client-side JavaScript
could never know definitively that an image is missing, only that it did
not full load by some specific time that you preset. It coul be that the
image is larger, visitor's connection is slow...whatever. My opinion very
*bad* idea.
Much better idea: put all image in a specified folder, say "slideshow"
then with PHP get a listing of the contents of the "slideshow" folder and
use it to both build the page and the JavaScript list to run the
slideshow! Then all you have to do is whatever you want in the show put
it in the folder, the rest is all automatic...
--
Jonathan
.
- References:
- checking for a file
- From: Eric
- Re: checking for a file
- From: Andy Dingley <dingbat@xxxxxxxxxxxxxx>
- Re: checking for a file
- From: Eric
- checking for a file
- Prev by Date: Re: quastion about frames
- Next by Date: Re: psds, dreamweaver, image maps
- Previous by thread: Re: checking for a file
- Next by thread: Re: checking for a file
- Index(es):
Relevant Pages
|