RE: ODB executable calculating file paths on IIS, Ben Blundell, 03-31-2006
I don't think you want to use the "input" variable
by Roger Harris, April 1, 2006 09:34
If you don't specify a full path for that variable, then the file is expected to be on (or relative to) the "current working directory," which is set by the Web server before executing CGIs. Different servers set that working directory differently, so that's why it's hard to get it to work the same on different systems.
If the file is on the Web root of both systems, then using http://server/cgi-bin/odb.exe/test.htm will work on both systems. There is a CGI convention to set up an environment variable named PATH_INFO containing the remainder of the URL after the CGI itself (for example in this case, PATH_INFO would contain just test.htm), and another variable named PATH_TRANSLATED that has the full file system path assuming that the file is to be mapped relative to the server's home directory and/or any virtual directories, the same way that the server would map the primary file in a URL. (For example, under IIS, if you have the default home directory set to c:/inetpub/wwwroot, then PATH_TRANSLATED would contain c:/inetpub/wwwroot/test.htm.) When the script file is given as part of the URL, ODBscript uses PATH_TRANSLATED to open the file.
If you need to reference the full file system path of other files (for example, INCLUDE files or output files that you want to write), ODBscript has a function named $pathTranslated( ) that uses the directory path in the PATH_TRANSLATED variable to resolve directories relative to the given script file, using standard syntax. For example, $pathTranslated("../file") would reference a file on the parent of the directory where the script file is located, or $pathTranslated("subdir/file") would reference a file that's on a subdirectory of the script file's directory.
Name E-mail optional TopicMessage:
HTTP Link: Link text: