Friday, February 4, 2011

Get File Name from URL (C#/.NET)

string FileName = URL.Substring(URL.LastIndexOf("/") + 1,
(URL.Length - URL.LastIndexOf("/") - 1));

Or:

string fileName = Path.GetFileName(url);

Ref:

http://www.thejackol.com/2007/04/10/get-file-name-from-url-cnet/

No comments: