Get file path and file extension

Badge +2

Hi all,

I'm wondering whether has any way I can get the file path and file extension while attaching a file. 

I have a ListView and when I attach a file to a file attachment control, it's automatically added to the ListView.


I can get the file name.


But I don't know how to get the file path and file extension. 



3 replies

To extract filename from the file, we use “GetFileName()” method of “Path” class. This method is used to get the file name and extension of the specified path string. The returned value is null if the file path is null. Syntax: public static string GetFileName (string path);

The challenge is the full path is only relevant for the current user.  A different user viewing that information may not have access to the original location. Once it is uploaded, you have the file so its original location is no longer needed by most applications.

Thanks for this thread..