jQuery, or javascript in general, can’t really connect directly to a database like you are describing. If you have an endpoint to hit, then jQuery (or vanilla javascript, really) could just fire a request to that endpoint with the specific data:
$('input:file').on('change', function(event) {
$.ajax({
url: '/path/to/endpoint',
type: 'post',
data: {
filename: $(this).val()
}
});
});
Alternatively, you could use a service like Parse, but I imagine that’s not what you’re asking.
For more reading, check out jQuery API: ajax.
solved How can I save the id of a div tag to a database when clicked and without refresh? [closed]