makeUriFromPath(path)
Last updated September 23, 2004
Version: 1 | Requires: CF5 | Library: FileSysLib
Description:
Accepts an aboluste path as input and returns a full URI as output. For example, "C:\Temp\Test.xml" returns "file:///C:/Temp/Test.xml".
Return Values:
Returns a URI.
Example:
<cfoutput>#makeUriFromPath(expandPath("test.xml"))#</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
path | Path to translate. | Yes |
Full UDF Source:
/**
* Creates a URI from an absolute path.
*
* @param path Path to translate. (Required)
* @return Returns a URI.
* @author Samuel Neff (sam@blinex.com)
* @version 1, September 23, 2004
*/
function makeUriFromPath(path) {
var uri = path;
// make all backslashes into slashes
uri = replace(uri, "\", "/", "all");
if (left(uri,1) is "/") {
uri = right(uri, len(uri) - 1);
}
uri = "file:///" & uri;
return uri;
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016