'); $('#form-upload input[name=\'file\']').trigger('click'); timer = setInterval(function() { if ($('#form-upload input[name=\'file\']').val() !='') { clearInterval(timer); if($("#form-upload input[name='file']")[0].files[0].size>10485760) { alert("Please upload less than 10 MB"); return false; } var ext = $('#form-upload input[name=\'file\']').val().split('.').pop().toLowerCase(); if($.inArray(ext, ['gif','png','jpg','jpeg','bmp']) == -1) { alert('invalid extension!'); return false; } $.ajax({ url: 'index.php?route=tool/upload', type: 'post', dataType: 'json', data: new FormData($('#form-upload')[0]), cache: false, contentType: false, processData: false, beforeSend: function() { $('#resultLoading').show(); }, complete: function() { $('#resultLoading').hide(); }, success: function(json) { $('.text-danger').remove(); if (json['error']) { $(node).parent().find('input').after('