AJAX upload function upgrade