diff options
Diffstat (limited to 'qc_app/files.py')
-rw-r--r-- | qc_app/files.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/qc_app/files.py b/qc_app/files.py index 205a39c..baac5ec 100644 --- a/qc_app/files.py +++ b/qc_app/files.py @@ -3,6 +3,7 @@ import hashlib from pathlib import Path from typing import Union from datetime import datetime +from flask import current_app from werkzeug.utils import secure_filename from werkzeug.datastructures import FileStorage @@ -21,3 +22,7 @@ def save_file(fileobj: FileStorage, upload_dir: Path) -> Union[Path, bool]: filepath = Path(upload_dir, filename) fileobj.save(filepath) return filepath + +def fullpath(filename: str): + """Get a file's full path. This makes use of `flask.current_app`.""" + return Path(current_app.config["UPLOAD_FOLDER"], filename).absolute() |