[ Previous ] [ Contents ] [ Index ] [ Next ]

Ns_UrlIsFile

Overview

Check if a file that corresponds to a URL exists

Syntax

    int Ns_UrlIsFile(
    char *hServer,
    char *URL
    );

Description

The Ns_UrlIsFile function constructs a file name by appending the URL to the current AOLserver pages directory for the specified server. It returns 1 if the file exists and is a regular file.

Examples

    /* IsFile - Simple request to determine if an URL is a file. */
    int
    IsFile(Ns_Conn *conn, void *ctx)
    {
    	int isfile;
    	char *server;
    
    	server = Ns_ConnServer(conn);
    	isfile = Ns_UrlIsFile(server, conn->request->url);
    	if (isfile) {
    		Ns_ConnReturnNotice(conn, 200, "File", NULL);
    	} else {
    		Ns_ConnReturnNotice(conn, 200, "Not a File", NULL);
    	}
    	return NS_OK;
    }

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1998-99 America Online, Inc.