Uploading a photo using XMLHtttpRequest to a Flask webserver
问题 I'm creating a WinJS app and using XMLHttpRequest to send a photo as a blob to a Flask webserver. openPicker.pickSingleFileAsync().then(function (file) { file.openAsync(Windows.Storage.FileAccessMode.read).done(function (stream) { var blob = MSApp.createBlobFromRandomAccessStream("application/octet-stream", stream); var fdata = new FormData(); fdata.append("file", blob, "photo.jpg"); var xmlhttp = new XMLHttpRequest(); xmlhttp.open("POST", "http://127.0.0.1:5000/api/addPhoto", true); xmlhttp