If the method succeeds, the return value is the number of characters
copied into the lpszFileUrl buffer, not including the
terminating null character. If a buffer is provided, it must be large
enough to contain the entire URL or the method will fail. If the
lpszFileUrl parameter is NULL, the method will return the length
of the URL and nothing will be copied. If the method fails, it will
return zero. To get extended error information, call the GetLastError
method.
The GetFilePathUrl method will return the URL associated
with the specified file path. This can be useful if you wish to display
or store URLs rather than relative paths to a file on the current server.
For example, if you are connected to the server example.com
on port 21 using a standard connection and you provide a relative file
path such as documents/invoice.pdf this method would
return a URL which looks like ftp://example.com/documents/invoice.pdf.
For security reasons, the resulting URL will never contain user
credentials.
The file path in the URL will be normalized to remove extraneous
directory traversals and path separators. If the path is relative, it
will be expanded to an absolute path based on the client's current working
directory. If an absolute path is provided, it will be included in the
URL as-is. It is not required for the file path to exist on the server
at the time this method is called. For more information about path
normalization, refer to the NormalizePath method.
This method can also be used to obtain a URL which can be passed
to the GetSercurityZoneId method to determine which
security zone should be assigned to the file when it is downloaded.