0

I am trying to upload a large file and having issues of submit happening twice. But not for small file sizes. The $("#fileform").ajaxSubmit({ call seems to be happening twice or multiple times instead of once. Or the submit 'success : function(data) {' . Not sure. I am able to see the details in 'commands_cvs_grpupload.jsp' twice.

HTML:

<form id="fileform" method="post" align="left">
    <input id="importFile" name="importFile" type="file" onkeydown="return   false"
           onpaste="return   false" ondragenter="return   false"/>
    <input id= "errorRecords" name = "errorRecords" type="hidden"/>
    <input id= "type" name = "type" value="BULK_UPLOAD" type="hidden"/>
    <input name="import" type="button" onClick="importCSV();" value="Import CSV"/>

Script for importCSV():

function importCSV(){
    if(checkFileIsNull()){
        $("#requiredFile").css("color","#000000");
        $("#requiredFileType").css("color","#000000");
        $("#gridWrapper").hide("slow");     
        configDisplayMessage("displayMessage","White");
        $("#displayMessage").html("");  
        $("#ui-progressbar-value").html("");
        $("#statusmessage").html("");
        $( "#progressbar" ).progressbar({
            value: 0
        });
        $("#processDiv").show();
        $("#progressbar").show();
        $("#statusmessage").show(); 
        $("#ui-progressbar-value").show();  
        $("#progressbar").html("Waiting...");
        // submit file to SBS; command is callaSBSImport
        submitFileToSBS();  
        // get status for SBS ; command is callSBSStatus 
        getStatusFromSBS();     
        startProcess = setInterval("getStatusFromSBS()",3000);      

    }else{
        $("#gridWrapper").hide("slow"); 
        $("processDiv").hide();
        $("#progressbar").hide();
        $("#statusmessage").hide();
        $("#ui-progressbar-value").hide();      
    }
} 

Script for submitFileToSBS()

function submitFileToSBS(){         
    $("#fileform").ajaxSubmit({
        type : "post",
        url : "framework/commands_cvs_grpupload.jsp", 
        dataType:"json",
        data : "Command=callSBSGroup&Service=ComplianceValidation&Method=uploadGroupings",
        success : function(data) {              
            setProcessBar(100,"Process is done.");
            clearInterval(startProcess);
            errorRecords =  Array();
            var list = "";
            var stringBuilder = "";             
            /*MY CODE*/
        },
        error : function (XMLHttpRequest, textStatus, errorThrown) {
            /*MY CODE*/
        }
    });
}

0 Answers0