hocam elinize yüreğinize sağlık oldu vallahi.

herhangi bir tasarım işiniz olursa lütfne bana mesaj atın yardımcı olmaktan memnuniyet duyarım.

bluexpres adlı üyeden alıntı: mesajı görüntüle
merhaba,
kodlara hızlıca baktım umarım atladığım bi şey yoktur aşağıdaki şekilde yapabilirsiniz.

iyi çalışmalar.


$('button[id^=\'button-upload\']').on('click', function() {
	var node = this;
dugme = $(this); // BU ŞEKİLDE OLMAZSA BAŞINA var EKLEYİN. aşağıdaki gibi.
//var dugme = ($this); 

	$('#form-upload').remove();

	$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');

	$('#form-upload input[name=\'file\']').trigger('click');

	if (typeof timer != 'undefined') {
    	clearInterval(timer);
	}

	timer = setInterval(function() {
		if ($('#form-upload input[name=\'file\']').val() != '') {
			clearInterval(timer);

			$.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() {
					$(node).button('loading');
				},
				complete: function() {
					$(node).button('reset')
              
					dugme.fadeOut(); //.remove kullanabilirsiniz. üstüne herhangi bi çıktı alanına .html .append vs. ile mesaj  düşürebilirsiniz.
				},
				success: function(json) {
					$('.text-danger').remove();

					if (json['error']) {
						$(node).parent().find('input').after('<div class="text-danger">' + json['error'] + '</div>');
					}

					if (json['success']) {
						alert(json['success']);
                        			$(node).parent().find('input').val(json['code']);
                        					}
				},
				error: function(xhr, ajaxOptions, thrownError) {
					alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
				}
			});
		}
	}, 500);
});