ajax image post ekleme
$("#file_upload").change(function(){
	var file_button = $(this);
	var my_files = file_button.prop('files'); //file_upload id li elemanı al, file input
	//var my_files = document.getElementById("file_upload").files;
	if (my_files.length){ //seçilen eleman var ise
		var dataArray = []; 
		/*
			dosyayı oluşturan verilerin ve isimlerinin bulunduğu dizi. Bu diziyi PHP tarafına post edeceğiz.
			PHP tarafında bu dizi üzerinde gerekli filtrelemeler yapılarak yüklenen dosyalarla ilgili geri dönüş sağlayacağız
		*/
		var file_length = my_files.length; //seçilen dosya sayısı
		for (var i = 0; i < file_length; i++) { //her bir dosya icin bu dongu calissin
			(function(file,counter) {
				if (file && file.type.match('image.*')){ // resim ise
					var name = file.name; //dosya isim
					var reader = new FileReader();  
					reader.onload = function(e) {  
						var text = e.target.result; //dosya verisi
						var infos = [text,name];
						dataArray.push(infos); //dataArray dizisine dosyanın verisi ve ismi olacak şekilde 2 elemanlı dizi ekle
						if (counter == file_length){ //sonuncu dosya da yuklendiyse dosya verilerini ajax ile post et.
							$.ajax({ //dosya data sını ajax.php ye postala
								url: "ajax.php", 
								type: "POST",             
								data: {"files" : dataArray},
								dataType: "json",
								success: function(data) {
									//yuklenen her dosya icin mesaj bildirim veya resim bilgi dizisi doner
									if (data.length > 0){
										for (var i = 0; i < data.length; i++){
											if (data[i][0] == "success"){
												//yuklenen resmin yuklendigi dizin bilgisiyle birlikte url yolunu ekle
												file_button.after('<br><br><hr><br><img src="'+data[i][1]+'" width="350px">');
											}else{
												//yuklenmeyen resmin ismi ve neden yuklenmedigini bildiren hata mesajını ekle
												file_button.after('<br><br><hr><br><strong>'+data[i][1]+'</strong> ==> '+data[i][0]);
											}
										}
									}else{
										alert("Bir hata oluştu");
									}
								}
							});

						}
					}
					reader.readAsDataURL(file); //oku
				}else{
					file_length--;
				}
			})(my_files[i],i+1);
		}
	}
});

Javascript相关代码片段

javascript isFunction

remove null, undefined or empty value on object

what is swiper used for?

use variable name inside string js

how to double number 2 number nodejs

dynamic nav tabs

dropzone file upload

fastest javascript map methods

nested conditional operator js

javascript subscribe example

javascript call function from external script

copy text to clipboard on click javascript

get age from date of birth javascript

Entity in nestjs

react js particles

$store.commit

Generate dates array using date range

electron nodemon

puppeteer kasada solver

react charts

xss sanitizer for next js

sort an arra

uncaught error: no url provided.

accordian js jquery ui

scrollreveal scrolling delay animations

oracle apex get page item value in javascript

manifest.json chrome extension

remove angular material theme

Lifting state up in ReactJS

firestore pagination example javascript

github javascript projects for beginners

react js scroll top

js listen for click on link

js listen for change in url subdomain

js detect change in subdomain name

how to detect when the browser url changes js

jquery animate counter

vs code console.log();

create a folder in vs code with its files

JavaScript Regex to Replace Links

complex javascript code

react change background color on scroll

angular mat-select default value

unit test angular

discord js audio not playing

forgot kali linux username and password

jquery removedata

process on unhandled exception

checkbutton tkinter get value

github delete local branch

laravel validation boolean must be true

set background image android

how to pass generic list as parameter in c#

cypress waiting for new page to load

leave input event

discord.js abortcontroller is not defined

asp.net mvc ajax post to controller

json dumps single quotes

@iconify-icons npm

invalid json response datatable

math array javascript

add icon to bottom tab navigator react native

how to set form invalid in angular 7

close modal after submit angular 8

jquery validate multiple fields with same name

get time seconds javascript

can js see zoom percentage

react-markdown

javascript simulate keypress

next-intl with zod

javascript event loop queue

nextjs disable eslint

javascript reduce break

javascript alert automatically disappears

javascript zlib

ajax slow response jquery

nextjs installation

image not selectable nextjs

nestjs change 201 to 200

next link types