52 lines
2.2 KiB
PHP
52 lines
2.2 KiB
PHP
<div class="row mb-3">
|
|
<label for="thumbnail" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Thumbnail') }}</label>
|
|
<div class="col-sm-10">
|
|
<input type="file" name="thumbnail" class="form-control ol-form-control" id="thumbnail" accept="image/*" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row mb-3">
|
|
<label for="banner" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Banner') }}</label>
|
|
<div class="col-sm-10">
|
|
<input type="file" name="banner" class="form-control ol-form-control" id="banner" accept="image/*" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row mb-3">
|
|
<label for="preview" class="form-label ol-form-label col-sm-2 col-form-label">{{ get_phrase('Preview Video') }}</label>
|
|
<div class="col-sm-10">
|
|
<input type="file" name="preview" class="form-control ol-form-control" id="preview" accept="video/*" />
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript">
|
|
"use strict";
|
|
document.getElementById('thumbnail').addEventListener('change', function(event) {
|
|
const file = event.target.files[0]; // Get the selected file
|
|
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
|
|
|
// Get the message from Laravel's get_phrase function
|
|
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
|
|
|
if (file && file.size > maxSize) {
|
|
// If the file is larger than 2 MB, show an alert and reset the input
|
|
alert(maxFileSizeMessage); // Use the translated message
|
|
event.target.value = ''; // Clear the selected file
|
|
}
|
|
});
|
|
document.getElementById('banner').addEventListener('change', function(event) {
|
|
const file = event.target.files[0]; // Get the selected file
|
|
const maxSize = 2 * 1024 * 1024; // 2 MB in bytes
|
|
|
|
// Get the message from Laravel's get_phrase function
|
|
const maxFileSizeMessage = '{{ get_phrase('The maximum file size is 2 MB.') }}';
|
|
|
|
if (file && file.size > maxSize) {
|
|
// If the file is larger than 2 MB, show an alert and reset the input
|
|
alert(maxFileSizeMessage); // Use the translated message
|
|
event.target.value = ''; // Clear the selected file
|
|
}
|
|
});
|
|
</script>
|