ajax - PHP: script executing twice -
i have php script processes xml file uploaded user . when file big (like 50mb) can take several minutes. on small files works how it's expected. faced 1 problem large ones.
so, file looks like:
if(file_exist($filename)) { return array(false, "file name exist"); } else { /* processing of file */ return array(true, "") } when user upload file javascript uploader, make ajax request script. , thing large file execute twice. first time go "processing" section, @ second time returns error file name exist (which true, actually).
i add logging function in beginning of script
$logger = zend_registry::get('logger'); $logger->log('assign file function called', 7); and see script has been called twice.
but in firebug see 1 ajax request script. in apache access.log see 1 request. apache error.log empty.
any idea can be? configuration long-time-executed scripts?
upd javascript calling script
$("#save_file_btn").click(function(){ var filename = $("input#selected_file").val(); if(!filename.length) { customalert("choose file @ first"); return false; } $.ajax({ url: '/otms/publisher/assign-file-to-publisher', beforesend: function(xhr){ $("#add_form").html('<div class="loader"></div>'); }, datatype: 'json', data: {filename: filename}, success: function(data) { if(data.success) { //process added onix file processonixfile(data.fileid, function(){ getfilelist(); $("#add_form").html('<div class="text-center">file has been uploaded</div>'); settimeout('$("#add_file_modal").modal("hide")', 2500); }); } else { var output = ''; $.each(data.error, function(index,value){ output += '<div class="bold">'+value.title+'</div>'; output += '<ul>'; $.each(value.errorlist, function(i, errormsg){ output += '<li>'+errormsg+'</li>'; }); output += '</ul>'; }); $("#add_form").html('<div class="red">'+output+'</div>'); } } }); }); i checked , place request made script 'assign-file-to-publisher' (where have problem).
upd 2.
what found out script called twice in firefox browser. in safari request doesn't return anything. in chrome returns following status:
(failed) net::err_empty_response i still not see error messages in application logs or apache logs. mentioned script works big file , can take several minutes process it.
in configuration:
max_execution_time = 300 while chrome return error on 1:40 time.
Comments
Post a Comment