Check if a file exists

Results 1 to 4 of 4

Thread: Check if a file exists

  1. #1
    Ben Roy Guest

    Default Check if a file exists

    I&#039m working on a catalog which contains a number of images for each product. What I&#039d like to do is after a person selects a product and the page is being built, check to see if a directory with the images exists. If it does, then add the images to the page, otherwise use images from the template directory. In other words:<BR><BR>&#060;%<BR>If Exists( then<BR> response.write "&#060;a href="http://.../CS-2342/images/main.jpg"&#062;"<BR>else<BR> response.write "&#060;a href="http://.../default/images/main.jpg"&#062;"<BR>end if<BR>%&#062;<BR><BR>That&#039s basically what I want to do but I don&#039t know how to write the "Exists()" function. Thanks for any help!<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Check if a file exists

    The code would be...<BR><BR>If FileExists(directory) then<BR><BR>I would make the path a variable and use the variable in the FileExists method.

  3. #3
    Ben Roy Guest

    Default RE: Check if a file exists

    Can I drop in an http path or does it require a file path?

  4. #4
    Ben Roy Guest

    Default One more thing

    Doh forgot one question on the last post. Do you know how expensive an operation this is? To be used sparingly?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts