Home>

HereI am trying to check the existence of files on the server with JQuery with reference to.

The upper row is the send button on HTML, and by pressing this I am trying to check the existence of the file in the lower row.
<input type = "submit" name = "extbtn" value = "update" />
  $(". Btn_upd"). click (function () {
        if (running_check ('N: \ bat \ EmgSampleJobOnRunning.txt')) {
            alert ("Please tell me again while running !!");
            return false;
        }
    });
    function running_check (fp) {
        var flg = is_file (fp);
        return flg
    }
   /**
     * File existence check
     * @param fp file path
     * /
    function is_file (fp) {
        var flg = null;
        $.ajax ({{
            url: fp,
            cache: false,
            async: false
        }) .done (function (data) {
            flg = true;
        })
        .fail (function (jqXHR, textStatus, errorThrown) {
            flg = false;
        });
        return flg;
    }
Question

I am trying to detect the existence of a file on a folder on a different server from the HTML file location, but the above code cannot detect it.
Is there still a problem with the description method (path name) of the file location in the part shown on the second line of JQuery?
The location of the HTML file is

If so, could you please tell me how to specify the file with the wrong drive? Thank you.

Excuse me for being rudimentary

  • Answer # 1

    I'm not sure because I haven't tried it ...

    First, on the server side, start the command prompt with administrator privileges,
    Execute the following command.

    mklink/d C: \ Apache24 \ htdocs \ ABCD \ bat N: \ bat

    The rest is JS,is_file ('bat/EmgSampleJobOnRunning.txt')
    How about doing it?

    * In short, from the client to the serverEmgSampleJobOnRunning.txtIt's OK if you can accessmklinkNot apacheAliasI feel like I can do it.

    * In any case, there is a security problem (N: \ batEquivalent to publishing below).

  • Answer # 2

    Files that can be searched by js (jQuery) are only in the public directory of httpd after all
    If you want to find a drive or directory that is not public
    It is necessary to entangle the server-side program, so please isolate it