上传文档时如何知道文档的扩展名 [英] How to know extension of the document when uploading the document
本文介绍了上传文档时如何知道文档的扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好小组成员,
我具有文件上传控制.用户可以上传任何文档(PDF,Word文档,记事本).浏览后,当用户单击上传"按钮时,我想知道他的文档扩展名.任何人都可以告诉我如何
Hello Group members,
I have file upload control.The user might upload any of the document(PDF,Word Document,Notepad).After browsing when the user click''s Upload button I want to know he extension of the document.Can any one tell me how can I get the extension of the document.
推荐答案
尝试:
string filename = myUploadControl.Filename;
string extension = filename.Substring(filename.LastIndexOf('.') + 1);
这篇关于上传文档时如何知道文档的扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文