Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

send multiple files using formdata jquery

//Javascript part
//file_input is a file input id
var formData = new FormData();
var filesLength=document.getElementById('file_input').files.length;
for(var i=0;i<filesLength;i++){
	formData.append("file[]", document.getElementById('file_input').files[i]);
}
$.ajax({
   url: 'upload.php',
   type: 'POST',
   data: formData,
   contentType: false,
   cache: false,
   processData: false,
   success: function (html) {
   
  }
});
 Run code snippet
Comment

PREVIOUS NEXT
Code Example
Javascript :: moment in react native 
Javascript :: remove animation css javascript 
Javascript :: hide label chratjs 
Javascript :: ref to another page and achor 
Javascript :: How to make the width of a react native element adjust according to the contents 
Javascript :: how to display items quantity into select input field 
Javascript :: discord.js send message to specific channel 
Javascript :: javascript use camera 
Javascript :: change url with javascript after 5 seconds 
Javascript :: Javascript console log a int 
Javascript :: ffmpeg convert mp4 to avi 
Javascript :: javascript const require 
Javascript :: react event target square brackets 
Javascript :: nghide angular 10 
Javascript :: change value of key in array of objects javascript 
Javascript :: datatable column width 
Javascript :: autocomplete react vscode 
Javascript :: iterate through list js 
Javascript :: Truncate a string-Javascript 
Javascript :: generate random color javascript 
Javascript :: javascript forever loop 
Javascript :: first day of month and last day of month moment js 
Javascript :: js get date in yyyy-mm-dd 
Javascript :: scrollheight jquery 
Javascript :: javascript animate elements 
Javascript :: get data from csv using vue js 
Javascript :: require is undefined 
Javascript :: javascript round to 2 digits 
Javascript :: iconify/react - npm 
Javascript :: duplicate an array in javascript n times 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =