Hi!
I am develeoping an application in asp.net with c# as the code behind.
I want to extract the file name form a string say, "C\documents\abc\abc.doc".
I have to get abc.doc in a variable.
I wanted to use the Split function and get the last item of the array, which would have given me the file name.
But, I am not been able to do so.
My code is
Th problem is Split function gives an error with the delimeter (\). With every other delimiter it works fine.Code:string strDocumentName = System.Web.HttpContext.Current.Request.Files[0].FileName.ToString(); string[]arrFile = strDocumentName.Split('\'); //Loop through the array arrFile for(int i=0;i<=arrFile.GetUpperBound(0);i++) { strDocumentName = arrFile.GetValue(i).ToString(); }
Pls help.




Reply With Quote