I have a frontend application which records Audio of the meeting.
The number of users and the meeting title and send it to the backend server which is FLASK(version 1.1.1) run with python 3.7.4.
I am able to get the Number of users and the meeting title but not the audio file.
Server code to capture the files.
@app.route('/upload', methods=['GET','POST'])
def start_process():
meeting_name = request.form['topic']
number_of_user = request.form['numberusr']
files = request.files['file']
I breakpointed it and here is the output.
(Pdb) request.form
ImmutableMultiDict([('topic', '3'), ('numberusr ', 'Meeting 2')])
(Pdb) request.files
ImmutableMultiDict([])
Flask returning
127.0.0.1 - - [05/Mar/2020 18:43:00] "POST /upload HTTP/1.1" 400 -
Here is the code how I am sending all the data to the flask server.
HTML FORM part
<form id="upload-file" method="post" action='/upload' enctype="multipart/form-data">
<audio controls id="audio" name="file" class="js-audio form-post-audio" src="">
</audio>
<fieldset>
<input name="topic" class="speakernumber">
</fieldset>
<fieldset>
<input name="numberusr " class="meetingname">
</fieldset>
</form>
**When the user presse stop, recording stops and this above form is filled and sent to the flask server. **
The Ajax code
var form_data = new FormData($('#uploadfile')[0]);
$.ajax({
type: 'POST',
url: '/upload',
data:form_data,
processData: false,
contentType: false
}).done(function(data) {
console.log(data);
});
Can someone give full code to send audio(which is recorded) to the backend flask server.