Simple file content validation #12

Merged
niat8586 merged 6 commits from simple-client-validation into develop 2025-02-04 11:32:33 +01:00
2 changed files with 3 additions and 3 deletions
Showing only changes of commit a37f4bb60b - Show all commits

View File

@ -45,10 +45,10 @@ function deleteSelected() {
function validateFile() {
const fileInput = document.getElementById('file');
const filePath = fileInput.value;
const allowedExtensions = /(\.mp3|\.mp4|\.mpeg|\.mpga|\.m4a|\.wav|\.webm|\.ogg)$/i;
const allowedExtensions = /(\.mp3|\.mp4|\.mpeg|\.mpga|\.m4a|\.wav|\.webm|\.ogg|\.mkv)$/i;
if (!allowedExtensions.exec(filePath)) {
alert('File type is not one of the recommended types. We recommend using MP3, MP4, MPEG, MPGA, M4A, WAV, WEBM, OGG.\n' +
alert('File type is not one of the recommended types. We recommend using MP3, MP4, MPEG, MPGA, M4A, WAV, WEBM, OGG, MKV.\n' +
'We can not guarantee that other file types will work as expected.');
fileInput.value = filePath;
return true;

View File

@ -35,7 +35,7 @@
<div class="mb-3">
<label for="file" class="form-label">Choose File</label>
<input type="file" id="file" name="file" class="form-control" required
accept=".mp3,.mp4,.mpeg,.mpga,.m4a,.wav,.webm,.ogg" onchange="validateFile()">
accept=".mp3,.mp4,.mpeg,.mpga,.m4a,.wav,.webm,.ogg,.mkv" onchange="validateFile()">
</div>
<div class="mb-3">
<label for="language" class="form-label">Select Language</label>