Re: checking for a file



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
.



Relevant Pages

  • Re: checking for a file
    ... accessing the server's filesystem from a remote web client, ... sandboxing that would obviously applied if such a feature were even ... As to the client, then you're again sandboxed from looking around the ... client's filesystem. ...
    (alt.html)
  • Re: Tier3 today - And Flex-it like NASDAQ (*Only better!*)
    ... FlexBuilder, or just working on the FABridge functionality in general, you ... ArrayCollections are completely accessible via the Javascript in ... Broadcasted server to client messages, ...
    (comp.os.vms)
  • Re: New MSDN MFC/ATL Forum
    ... I still don't see how using JavaScript could be a security issue? ... You can't run programs in the client space or access the users devices. ... I was amaze at the China/Google zero-day IE security bug where in NO ... I was turning JavaVirus and ActiveVirus off years ago in IE. ...
    (microsoft.public.vc.mfc)
  • Re: Visual Studio only debugs javascript in .js files not .aspx fi
    ... An ASPX page is a class that generates HTML ... from the server. ... including any literal JavaScript in the page code, ... is used by the client browser to execute JavaScript on the client side, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Question about client-side
    ... typically several hundred client computers. ... First of all, JavaScript doesn't have applets. ... JavaScript can be placed inline in the HTML code, or in external files. ...
    (microsoft.public.dotnet.framework.aspnet)