禁止的文件类型 docx
Forbidden File Type docx
我正在测试 uploadifive 插件文件上传限制,我似乎无法让它接受 .docx 文件。在文档中 (http://www.uploadify.com/documentation/uploadifive/filetype/) I have followed the instructions (bar a small mistake - the pipe "|" character does not work) and have used the media types it refers to (http://www.iana.org/assignments/media-types/media-types.xhtml)。似乎没有其他文件类型导致问题,例如.doc、.xlsx。
是否有解决方案,我已经检查了多个来源,据我所知,mime 类型 (application/vnd.openxmlformats-officedocument.wordprocessingml.document) 是否正确?
<h1>UploadiFive Demo</h1>
<form>
<div id="queue"></div>
<input id="file_upload" name="file_upload" type="file" multiple="true">
<a style="position: relative; top: 8px;" href="javascript:$('#file_upload').uploadifive('upload')">Upload Files</a>
</form>
<script type="text/javascript">
$(function() {
$('#file_upload').uploadifive({
'auto' : false,
'checkScript' : 'check-exists.php',
'queueID' : 'queue',
'uploadScript' : 'uploadifive.php',
'fileType' : ['application\/msword', 'application\/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application\/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml','application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
'onUploadComplete' : function(file, data) { console.log(data); },
'onError' : function(errorType)
{
alert('Error: ' + errorType);
},
});
});
</script>
问题在于 Firefox 将 MIME 类型 "application/vnd.ms-word.document.12" 分配给文件,而不是 "application/vnd.openxmlformats-officedocument.wordprocessingml.document" 分配给 .docx 文件。 Chrome 并且可能其他人使用的是正确的。
事实证明,这个 post (How to check file MIME type with javascript before upload?) 有助于了解浏览器如何处理它。
我正在测试 uploadifive 插件文件上传限制,我似乎无法让它接受 .docx 文件。在文档中 (http://www.uploadify.com/documentation/uploadifive/filetype/) I have followed the instructions (bar a small mistake - the pipe "|" character does not work) and have used the media types it refers to (http://www.iana.org/assignments/media-types/media-types.xhtml)。似乎没有其他文件类型导致问题,例如.doc、.xlsx。
是否有解决方案,我已经检查了多个来源,据我所知,mime 类型 (application/vnd.openxmlformats-officedocument.wordprocessingml.document) 是否正确?
<h1>UploadiFive Demo</h1>
<form>
<div id="queue"></div>
<input id="file_upload" name="file_upload" type="file" multiple="true">
<a style="position: relative; top: 8px;" href="javascript:$('#file_upload').uploadifive('upload')">Upload Files</a>
</form>
<script type="text/javascript">
$(function() {
$('#file_upload').uploadifive({
'auto' : false,
'checkScript' : 'check-exists.php',
'queueID' : 'queue',
'uploadScript' : 'uploadifive.php',
'fileType' : ['application\/msword', 'application\/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application\/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml','application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
'onUploadComplete' : function(file, data) { console.log(data); },
'onError' : function(errorType)
{
alert('Error: ' + errorType);
},
});
});
</script>
问题在于 Firefox 将 MIME 类型 "application/vnd.ms-word.document.12" 分配给文件,而不是 "application/vnd.openxmlformats-officedocument.wordprocessingml.document" 分配给 .docx 文件。 Chrome 并且可能其他人使用的是正确的。
事实证明,这个 post (How to check file MIME type with javascript before upload?) 有助于了解浏览器如何处理它。