#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Ireland
    Posts
    170
    Rep Power
    13

    help: is this possible in javascript - check if file exists


    Hi,

    I have a problem with checking if a file exists. Due to server restrictions, I cant do this in PHP so I am hoping there is a way to do it in javascript.

    I have a page that passes $day, $date and $year through a form.

    These are then used in a url like this track$day$month$year.html ie: track12022003.html

    What I need is the code to check if the file exists, if it does it will go that file and if it doesnt it will go to noresults.html

    ie:
    PHP Code:
    file track$day$month$year.html
    if(file exists){
     
    go to the file's url
    else{
     the file doesnt exist so load the noresults.html fil;e

    Any help with this is appreciated.

    Thanks,
    Martin
  2. #2
  3. Super Genius
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    Orlando, Florida
    Posts
    314
    Rep Power
    13
    Do you have shell access to the web server? If so, look into a PERL or Bash script to solve your problem.
    Sleep is highly overrated.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Ireland
    Posts
    170
    Rep Power
    13
    Hi,

    the web server is in our office but the pwoers that be wont install PHP on it for me. it has got PERL though but I have zero PERL experience, do you know how this could be done in PERL?

    Martin
  6. #4
  7. Super Genius
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    Orlando, Florida
    Posts
    314
    Rep Power
    13
    Unfortunately not. Try your luck in the PERL Forum.
    Sleep is highly overrated.

IMN logo majestic logo threadwatch logo seochat tools logo