You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何获取.eml文件对应input accept属性的正确MIME类型

.eml文件在HTML file input中的正确MIME类型

.eml是电子邮件格式文件,对应的标准注册MIME类型是message/rfc822,这是浏览器能够正确识别的官方类型,你之前尝试的application/eml并非IANA注册的合法MIME类型,因此无法生效。

修改后的file input代码如下:

<input type="file" name="data[File][0][attachment]" accept="application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,message/rfc822" style="display:inline;width:70% !important;" class="file-upload" />

额外兼容性提示:部分浏览器支持直接在accept属性中使用文件扩展名,你可以同时添加.eml来覆盖更多场景,写法如下:

<input type="file" name="data[File][0][attachment]" accept="application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,message/rfc822,.eml" style="display:inline;width:70% !important;" class="file-upload" />

内容的提问来源于stack exchange,提问作者Kim Stacks

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 03:52:01