使用asp.net C#在sql server 2008中上传文件 [英] Uploading documents in sql server 2008 using asp.net C#
问题描述
我正在研究不同的方法和技术,将文档上传和下载到使用ASP.Net和C#的Web应用程序的sql server 2008数据库中。
I'm currently researching different methods and techniques into uploading and downloading documents into a sql server 2008 database using ASP.Net and C# for a web application.
我发现这个 excel教程,我想知道是否会以类似的方式上传pdf和word文档?
I have found this excel tutorial, and i was wondering if it would be similar to upload pdf and word documents in a similar way?
谢谢
推荐答案
考虑到您分享的链接中的示例,使用以下验证:
Considering the example in the link you shared, use the following validation:
switch (ext.ToLower())
{
case ".pdf":
type = "application/pdf";
break;
case ".doc":
type = "application/msword";
break;
case ".docx":
type = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
}
这里是一些更多的MS Office 2007 MIME类型,您可以考虑和< a href =http://www.fileformat.info/info/mimetype/all.htm =nofollow>所有MIME类型,您可以找到更广泛的列表。
Here are some more MS Office 2007 MIME types you may consider and on All MIME Types you may find a broader list.
这篇关于使用asp.net C#在sql server 2008中上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!