Reply to Re: checking for a file

Your name:

Reply:


Posted by Jonathan N. Little on 05/20/06 01:36

In article <p-adneUqib3MYPDZRVn-tw@comcast.com>, nospam@email.com 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

[Back to original 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

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