Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

formdata is empty after append in angular

const uploadFile = (files) => {
  console.log("Uploading file...");
  const API_ENDPOINT = "https://file.io";
  const request = new XMLHttpRequest();
  const formData = new FormData();

  request.open("POST", API_ENDPOINT, true);
  request.onreadystatechange = () => {
    if (request.readyState === 4 && request.status === 200) {
      console.log(request.responseText);
    }
  };
  
  for (let i = 0; i < files.length; i++) {
    formData.append(files[i].name, files[i])
  }
  request.send(formData);
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to take yes or no in js 
Javascript :: reactjs sweet alert 
Javascript :: json regex 
Javascript :: vue slice words 
Javascript :: leaflet js mobile popup not opening 
Javascript :: sleep 1 second 
Javascript :: javascript typed array 
Javascript :: Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.6/$injector/modulerr?p0=myApp 
Javascript :: Get Country from the international phone number 
Javascript :: print json object 
Javascript :: javascript reload section 
Javascript :: ajax post csrf codeigniter 
Javascript :: html select multiple selected values 
Javascript :: phantomjs in angular 
Javascript :: router.push next js 
Javascript :: .html jquery in javascript 
Javascript :: js two array combining with id neasted 
Javascript :: javascript conditional 
Javascript :: get field type file js and loop 
Javascript :: object method in javascript 
Javascript :: lowest common ancestor leetcode 
Javascript :: js spread operator component example 
Javascript :: create index mongodb 
Javascript :: jest called times 
Javascript :: how to set random dice image with js 
Javascript :: how to check if a letter is capital in javascript 
Javascript :: node js simple server 
Javascript :: js not startswith 
Javascript :: get random elements from array javascript 
Javascript :: news api react native 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =