return file names for transcription-files API
import os
from pathlib import Path
-from flask import Blueprint, redirect, request, url_for, escape
+from flask import Blueprint, redirect, request, url_for, escape, jsonify
from werkzeug.utils import secure_filename
from ..blueprint import Blueprint
from . import comp
@@ -50,12 +50,13 @@ def transcription_files():
# handle incoming data
if request.method == 'POST':
- # print(f'Trans_files req: {request.json}')
- print(f'request.form: {request.form}')
- print(f'request.args: {request.args}')
-
- # return state update
- return f'{os.listdir(path)}'
+ uploaded_files = request.files.getlist("file")
+ file_names = []
+ for file in uploaded_files :
+ print(f'file: {file}')
+ print(f'file name: {file.filename}')
+ file_names.append(file.filename)
+ return jsonify(file_names)
@bp.route("/pronunciation")
def pronunciation():
