Skip to content

Instantly share code, notes, and snippets.

@matthewarkin
Last active June 17, 2016 20:29
Show Gist options
  • Save matthewarkin/9089f6e9c2071c0036bd3b88b3bf27e3 to your computer and use it in GitHub Desktop.
Save matthewarkin/9089f6e9c2071c0036bd3b88b3bf27e3 to your computer and use it in GitHub Desktop.
<html>
<input type="file" id='fileForm' >
<input type="submit"onclick="submitForm()">
<script>
submitForm = function(){
var formData = new FormData();
formData.append('purpose', 'identity_document');
formData.append("file", document.getElementById("fileForm").files[0]);
fetch("https://uploads.stripe.com/v1/files", {
method: 'POST',
mode: 'cors',
headers: {
"Authorization": 'Bearer pk_test_BbfCyK5c89Xg8qeeSUqvqQaX',
"Content-Type": "multipart/form-data"
},
body: formData
})
.then(function(d){console.log(d)})
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment