我有以下输入字段,提示用户上传给定的文件格式。
<input name="file" type="file" id="inputGroupFile01" accept=".xls, .xlsx">但是还有许多其他的文件扩展名,比如XLSM、XLTX、XLTM等等。有没有一种方法可以允许所有类型的excel格式,而不需要单独编写每一种格式。
。
另外,请记住,当选择一个文件时,我将调用一个JS函数,以确保所选文件的扩展名正确
var fileType = $('#inputGroupFile01').val().split('.').pop();
if (fileType != 'xls' && fileType != 'xlsx'){
*error msg*
}谢谢你的帮助。
发布于 2019-08-26 15:37:37
你应该试着戴口罩
<input name="file" type="file" id="inputGroupFile01" accept=".xl*">发布于 2019-08-26 15:38:56
你可以在这里找到所有excel扩展名的列表:https://docs.microsoft.com/en-us/deployoffice/compat/office-file-format-reference#file-formats-that-are-supported-in-excel。然后将其复制粘贴到json文件中,然后使用js加载文件。
https://stackoverflow.com/questions/57653531
复制相似问题