G
Guest
Hello,
When it's needed to upload a file, and get the name of it:
uploadfile is a HtmlInputFile type:
string NameOfFile = uploadfile.PostedFile.FileName;
NameOfFile will not only get the name of the file, but the complete path on
which it was on the client ("C:\somefolder\test.exe"). How to get just the
file name (test.exe), without path information?
I know, I could just cut the string, search for the appearance of "/" or "\"
cut the rest etc. but, isn't there a more elegant way?
When it's needed to upload a file, and get the name of it:
uploadfile is a HtmlInputFile type:
string NameOfFile = uploadfile.PostedFile.FileName;
NameOfFile will not only get the name of the file, but the complete path on
which it was on the client ("C:\somefolder\test.exe"). How to get just the
file name (test.exe), without path information?
I know, I could just cut the string, search for the appearance of "/" or "\"
cut the rest etc. but, isn't there a more elegant way?