Thursday, September 06, 2007

File URIs

URI - Uniform Resource Identifier
A URI for a web resource might be http://krishnabhargav.blogspot.com
Most of the api might require you to specify URI for local files instead of having a local path. Suppose you want to pass a local system file as a parameter and it should be in the form of an URI then you can do this:
Let us say the file is D:/Development/MyResource.txt
Then the fileUri would be something like
file:///D:/Development/MyResource.txt

One most common mistake is to use file:// instead of file:///. We go by the notion that http has "//" and so does ftp. So even this "file" would have "//" in its Uri. But it is "///" instead of "//".

One good and more detailed explanation is given here.
http://blogs.msdn.com/ie/archive/2006/12/06/file-uris-in-windows.aspx
I really appreciate his post.

No comments: