<?php
add_action( 'wp_ajax_wosmpl_upload_file', 'wosmpl_ajax_upload_file' );

function wosmpl_ajax_upload_file()
{
    check_ajax_referer( 'wosmpl_ajax', '_ajax_nonce' );

    wp_send_json(
        wosmpl_upload_file($_POST['file'])
    );

    wp_die(); // all ajax handlers should die when finished
}
