aboutsummaryrefslogtreecommitdiff
path: root/qc_app/files.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-01-16 12:48:43 +0300
committerFrederick Muriuki Muriithi2024-01-16 12:53:46 +0300
commit6222ebc5ca0fdeaac9ce7addd07ee4dd900a1afb (patch)
tree7fc9add59eaf6d505a8dcfcc20b5af9c11bb211b /qc_app/files.py
parentd809997e8ca76d2441b58693078c6c9698e769bb (diff)
downloadgn-uploader-6222ebc5ca0fdeaac9ce7addd07ee4dd900a1afb.tar.gz
UI: Create UI to select from existing genotype datasets.
Diffstat (limited to 'qc_app/files.py')
-rw-r--r--qc_app/files.py5
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()