wordpress file upload from direct directory not working

I fix this problems with wordpress file upload method:

php file:

add_action( 'wp_ajax_file_upload', 'file_upload_callbacks' );
add_action( 'wp_ajax_nopriv_file_upload', 'file_upload_callbacks' );


function file_upload_callbacks() {
    
    $arr_img_ext = array('application/pdf');
 if (in_array($_FILES['file']['type'], $arr_img_ext)) {
     $upload = wp_upload_bits($_FILES["file"]["name"], null, file_get_contents($_FILES["file"]["tmp_name"]));
     //$upload['url'] will gives you uploaded file path

     //var_dump($upload['url']);

     wp_send_json( $upload['url'] );
 }
 wp_die();
}