What I have done so far in App Inventor
1. Record voice using SoundRecorder. [works]
2. Play it using Player. [works]
3. Post it to http server. [not working].
I have done same thing using Java Script in browser and it works.
Java Script:-
function uploadToServer(blobOrFile) {
var username = "xxxxxx";
var password = "xxxxxxxxx";
var formData = new FormData();
formData.append('file', blobOrFile, 'output.wav');
var request = new XMLHttpRequest();
request.addEventListener("load", reqListener);
request.open("POST", "/commands", true, username, password);
request.send(formData);
}
Here is the HTTP Flask Server code which handles file upload.
""" Route that will process audio """
@app.route('/commands', methods=['POST'])
@requires_auth
def process_commands():
"""Get user submitted audio file, save, process and then delete."""
print request.headers
print request.__dict__
print request.args
print request.form
print request.files
""" Get the name of the uploaded file """
file = request.files['file']
Trying to do similar using App Inventor, but dont know where is the problem.
I want to do the JS equilavant thing in App Inventor but didnt get any example.
Have attached the Blocks
