Search code examples
javahtmlspringspring-bootthymeleaf

Boot CRUD Application with Thymeleaf: accept video types


I have a SpringBoot app. with this thymelaf template in order to accept all video types

<!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>

but it seems that only MP4 is accepted, but not mkv,

Testing with Chrome v87.0.4280.88 (Build oficial) (x86_64)


Solution

  • Try below solution as a workaround.

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

    Explanation https://stackoverflow.com/a/56455137/6572971