Fixed Video upload not working

This commit is contained in:
Jan 2024-08-20 16:29:51 +02:00
parent 54e805ec50
commit 3eac9d64cb

View File

@ -350,20 +350,7 @@ def sendpage():
# handle possible Video that was send
if 'recordedVideo' in request.files:
print("------------------------trying to save the video-------------------------------")
#print("request.max_content_length:", request.max_content_length)
#print("request.max_form_memory_size:", request.max_form_memory_size)
#print("request.accept_mimetypes:", request.accept_mimetypes)
#print("request.args:", request.args)
#print("request.content_length:", request.content_length)
video = request.files['recordedVideo']
#print("request.data:", request.data)
#print("request.files:", request.files)
#print("request.form:", request.form)
print("video: ",video)
print("video.content_length: ", video.content_length)
#print("MIME type: ", video.mimetype)
#print("File name: ", video.filename)
formatted_date = date.strftime("%Y.%m.%d %H-%M-%S")
print("date: ", date)
video_name = str(session_user_id) + "_" + session["current_block_name"] + "_" + session["current_stimulus_name"] + "_" + str(formatted_date) + ".webm"
@ -371,7 +358,6 @@ def sendpage():
print("path: ",path)
os.makedirs(UPLOAD_FOLDER, exist_ok=True)
video.save(path)
print("------------------------END trying to save the video-------------------------------")
if 'recordedVideo' in request.files:
if hasattr(new_entry, "video_upload"):
@ -392,16 +378,6 @@ def sendpage():
print("Error occurred: {e}".format(e=str(e)))
return "There was a problem while adding the response to the Database"
# handle possible Video that was send
if 'recordedVideo' in request.files:
video = request.files['recordedVideo']
formatted_date = date.strftime("%Y.%m.%d %H-%M-%S")
print("date: ", date)
video_name = str(session_user_id) + "_" + session["current_block_name"] + "_" + session["current_stimulus_name"] + "_" + str(formatted_date) + ".webm"
path = os.path.join(UPLOAD_FOLDER, video_name)
print("path: ",path)
os.makedirs(UPLOAD_FOLDER, exist_ok=True)
video.save(path)
if (session["current_block_index"] == session["number_of_blocks"]-1) and (session["current_stimulus_index"] >= session["number_of_stimuli"]-1):
#update the database entry, the form is completed