Jquery Ajax PHP无法获取上传的文件名

I am trying to display this "echo $_FILES['userfile']['name'];" on browser console but unfortunately I got this "function File() { [native code] }"

Here is my jquery code

<?= form_open_multipart('',' id="importform" method="POST" ');?>

    <div><input type="file" name="userfile"></div><button type="submit>upload</button>
var formdata = new FormData();
            formdata.set('userfile',$('input[name="userfile"]')[0].files[0],File);
            $.ajax({
                url:'http://localhost/selection/index.php/CI_Inner/importResult',
                type: 'POST',
                dataType: 'html',
                contentType: false,
                processData: false,
                data: formdata,
                success: function(data){
                    console.log(data);
                }

Try this

function uploadImage() {
         // send the formData
        var formData = new FormData( $("#userfile")[0] );

    if (typeof formData !== 'undefined') {



        $.ajax({
            url : 'http://localhost/selection/index.php/CI_Inner/importResult',  // Controller URL
            type : 'POST',
            data : formData,
            async : false,
            cache : false,
            contentType : false,
            processData : false,
            success : function(data) {
                successFunction(data);
            }
        });

    } else {
       message("Your Browser Don't support FormData API! Use IE 10 or Above!");
    }   
}

Note: instead of 'http://localhost/selection/index.php/CI_Inner/importResult' using direct URL baseUrl + 'importResult',

example: url : 'http://localhost/selection/index.php/CI_Inner/importResult',

url: baseUrl + 'importResult',

Eventually I solved this by just removing the parameter 'File' from my code below

var formdata = new FormData();
        formdata.set('userfile',$('input[name="userfile"]')[0].files[0],**File**);
        $.ajax({
            url:'http://localhost/selection/index.php/CI_Inner/importResult',
            type: 'POST',
            dataType: 'html',
            contentType: false,
            processData: false,
            data: formdata,
            success: function(data){
                console.log(data);
            }

And now it works fine with the code below

var formdata = new FormData();
            formdata.set('userfile',$('input[type=file]')[0].files[0]);
            $.ajax({
                url : 'http://localhost/selection/index.php/CI_Inner/importResult',
                type: 'POST',
                dataType: 'html',
                contentType: false,
                processData: false,
                data: formdata ,
                success: function(data){
                    console.log(data);

                }