检测真实文件类型 [英] Detect the real file type

查看:73
本文介绍了检测真实文件类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!

检查扩展名,并非总是可以提供真实的文件类型.例如,一个.mp3文件被错误地更改为.xls,但该文件仍然是mp3文件,而不是excel文件.

Checking the extension , not always can give the real file type. For example a .mp3 file by mistake is changed to .xls , but the file is still an mp3 file and not an excel file.

有什么方法可以检测真实文件的类型?

Is there any way to detect the real file's type ?

(我对Excel和Word文件特别感兴趣).

( I'm interested especially for Excel and Word files ).

谢谢!

推荐答案


您能告诉我们您的源代码吗?

'---的扩展名" C:\ filename.xls"
stExtension 字符串 C:\ filename.xls '-显示扩展名
.Show(stExtension)

Hi,
Could you show us your source code?

' --- get the extension of "C:\filename.xls"
Dim stExtension AsString = System.IO.Path.GetExtension("C:\filename.xls")
' --- display extension
MessageBox.Show(stExtension)


这篇关于检测真实文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆