Created
March 8, 2017 12:27
-
-
Save slavic18/ee86accde2c0fb1210185a929ff8e3d8 to your computer and use it in GitHub Desktop.
Send file trough native http request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var req = new XMLHttpRequest() | |
var file = new Blob(['This is a test'], { type: 'text/plain' }) | |
var data = new FormData() | |
data.append('photo', file, 'test.txt') | |
req.open('POST', '/upload') | |
req.send(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment