如何在C#中找到文件的扩展名? [英] How to find the extension of a file in C#?
本文介绍了如何在C#中找到文件的扩展名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的Web应用程序(asp.net,c#)中,我正在页面中上传视频文件,但我只想上传flv视频.上传其他扩展视频时如何限制?
In my web application (asp.net,c#) I am uploading video file in a page but I want to upload only flv videos. How can I restrict when I upload other extension videos?
推荐答案
string myFilePath = @"C:\MyFile.txt";
string ext = Path.GetExtension(myFilePath);
// ext would be ".txt"
这篇关于如何在C#中找到文件的扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文