我如何获取内容类型 [英] How I Get Content Type

查看:72
本文介绍了我如何获取内容类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一下如何使用vb.net获取windows窗体中所有文件的内容类型?

如果我在ASP.NET中,我可以通过fileupload1.postedfile.contenttype获取它但是我不能在vb.net中这样做..



你可以帮帮我吗?

拜托,我需要它..

i感谢你的回答

非常感谢

i want to ask how i get content type in all of files in windows form with vb.net?
if i do in ASP.NET, i can get it by fileupload1.postedfile.contenttype.but i cant do like that in vb.net..

can you help me?
please,i need it..
i appreciate answer from you
thanks very much

推荐答案

回答你的问题是不可能的,因为在你的例子中,有一个运行的服务器接收文件。



VB.NET不是服务器,所以它不提供相同的功能。您必须编写自己的服务器来接受文件上传,但是您还必须编写代码来执行MIME类型查找,以将内容类型分配给您用于跟踪服务器中文件的元数据。 br />


谷歌的vb.net获取内容类型的文件扩展名,你会发现这个操作有多么不稳定。它基本上是对内容类型的猜测。
It's impossible to answer your question because, in your example, there is a server running that receives the file.

VB.NET is not a server so it doesn't offer the same functionality. You would have to write your own server that will accept file uploads, but then you also have to write the code to do MIME type lookups to assign a content type to the meta data you're using to track the file in your server.

Google for "vb.net get content type of file extension" and you'll find just how unstable this operation is. It's, basically, a guess at what the content type is.


非常感谢Dave Kreskowiak :)

它帮助我..
thanks very much Dave Kreskowiak :)
it's help me..


这篇关于我如何获取内容类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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