我在网站上有一个文件上传网页表单,它只需要接受某些格式(或MIME类型)...
以下代码完美地工作,除了,它不会将.DOCX文件上传到服务器!这是唯一不起作用的文件类型...我已经仔细检查了每一行代码,甚至已经进入IIS管理器以确保继承了.DOCX MIME类型,它们是......
有没有人知道为什么.DOCX文件不会像其他所有文件类型一样上传到服务器?
代码片段:
string savePath = "D:\\HIDDEN PATH HERE";
string fileMsg;
// Before attempting to perform operations
// on the file, verify that the FileUpload
// control contains a file.
if (FileUpload1.HasFile)
{
// Check to see that the content type is proper and allowed.
// DOC: application/doc, appl/text, application/vnd.msword, application/vnd.ms-word, application/winword, application/word, application/x-msw6, application/x-msword
if (
FileUpload1.PostedFile.ContentType == "text/rtf" ||
FileUpload1.PostedFile.ContentType == "application/doc" ||
FileUpload1.PostedFile.ContentType == "appl/text" ||
FileUpload1.PostedFile.ContentType == "application/vnd.msword" ||
FileUpload1.PostedFile.ContentType == "application/vnd.ms-word" ||
FileUpload1.PostedFile.ContentType …Run Code Online (Sandbox Code Playgroud)