Javascript:上传两个文件表单和一个按钮提交

My intention for this project is to upload two files using one submit button that executes different functions.

For example, I have a file in csv format named "A" that has data on longitude/latitude and I have a function that calculates the distance between them and stores it into an array.

My second file "B" has missing information on the distance so what I would like to do is store the distance into the second file and have it shoot out a new file containing B with that missing information from A.

Now I can upload file A and have it execute the functions without any problems but when I try to upload file B it's saying it does not exist.

My question is how can I have two upload forms but submit both at once while performing different functions on each file. Of course file A has to finish performing the calculations before that can be inserted into file B.

        <input type="file" id="A" />
        <form method="get" id="uploadA" >
        <input type="file" id="B" />
        <form method="get" id="uploadB" >

submitForms = function(){
     $('#fileA').submit(a()); 
     $('#fileB').submit(b());}


var b = function () {
    var fileUser = document.getElementById('#fileB'); 
    var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.csv|.txt)$/; 
    if (regex.test(fileUser.value.toLowerCase())) {
        if (typeof (FileReader) != 'undefined') {
            var reader = new FileReader();
            reader.onload = function (e) {
                var table = document.createElement('table');
                var rows = e.target.result.split("
");
                for (var i = 0; i < rows.length; i++) {
                    var row = table.insertRow(-1); 
                    var cells = rows[i].split(","); 
                    //do something

                }
                reader.readAsText(Userfile.files[0]);
            }
        }else {
            alert("This browser does not support HTML5.");
        }
    } else {
        alert("Please upload a valid CSV file.");
    }
    return false; //prevent the form from submitting
}

});