【问题标题】:Boot CRUD Application with Thymeleaf: accept video types使用 Thymeleaf 启动 CRUD 应用程序:接受视频类型
【发布时间】:2021-03-29 23:03:57
【问题描述】:

我有一个 SpringBoot 应用程序。使用此 thymelaf 模板以接受所有视频类型

<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <!-- Meta Tags -->
    <meta charset="UTF-8">

</head>

<body class="public app app-embed" onorientationchange="window.scrollTo(0, 1)">

<div id="form-embed">

    <div id="messages"></div>

    <form action="#" th:action="@{/adduser.html}" th:object="${user}" method="post" enctype="multipart/form-data">

        <!-- File -->
        <div class="form-group textogbcn">
            <label  for="video">Video</label>
            <input type="file" id="video"  name="files" accept="video/*">
        </div>



    </form>

</div>
</body>

</html>

但是好像只接受MP4,不接受mkv,

使用Chrome v87.0.4280.88 (Build oficial) (x86_64)进行测试

【问题讨论】:

  • 你能在 JS fiddle 上分享/演示你的项目吗jsfiddle.net
  • Accept 属性似乎很好。它应该接受所有视频。你能检查一下你的浏览器是否没有更新或者它支持html 5标签等请求检查浏览器兼容性
  • 请分享您用于测试的浏览器及其版本。与标签堆栈无关。它仅与 HTML 5 Input 标签相关

标签: java html spring spring-boot thymeleaf


【解决方案1】:

尝试以下解决方案作为解决方法。

<input type="file" accept="video/*,.mkv">

解释https://stackoverflow.com/a/56455137/6572971

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-08
    • 1970-01-01
    相关资源
    最近更新 更多