Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <input type="file" id="fileInput" />
</body>
</html>
 
var input = document.querySelector("#fileInput");
input.addEventListener("change", function() {
  var file = input.files.item(0);
  console.log(file);
  var formData = new FormData();
  formData.append("file_field", file, "file.name.from.js");
  
  var xhr = new XMLHttpRequest();
  xhr.open("POST", "http://zn-testbed.herokuapp.com/web_support/echo.json", true);
  xhr.send(formData);
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
pwnallpro
0viewers