I'm currently working on a modal window that includes a file upload feature. Within this modal, there is a button labeled "send to email." I'm looking for guidance on how to create a function that will successfully send the uploaded file to an email address.
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
Launch Modal
</button>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg modal-fullscreen-lg-down">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="file-loading">
<input id="input-b9" name="input-b9[]" multiple type="file">
</div>
<div id="kartik-file-errors"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Send to email</button>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$("#input-b9").fileinput({
showPreview: false,
showUpload: false,
elErrorContainer: '#kartik-file-errors',
allowedFileExtensions: ["pdf", "doc", "docx"]
//uploadUrl: '/site/file-upload-single'
});
});
</script>