diff --git a/web/app/corpora/views.py b/web/app/corpora/views.py
index 914055157069d1cc6d15410e8e24c3147cc998a5..3b2899d041167f25675f575844a1ae050c0dbbcd 100644
--- a/web/app/corpora/views.py
+++ b/web/app/corpora/views.py
@@ -336,7 +336,7 @@ def add_query_result():
         db.session.flush()
         db.session.refresh(query_result)
         try:
-            os.makedirs(query_result.path)
+            os.makedirs(os.path.dirname(query_result.path))
         except OSError:
             logging.error('Make dir {} led to an OSError!'.format(query_result.path))  # noqa
             db.session.rollback()
@@ -344,11 +344,9 @@ def add_query_result():
             return make_response(
                 {'redirect_url': url_for('.add_query_result')}, 500)
         # save the uploaded file
-        query_result_file_path = os.path.join(query_result.path,
-                                              query_result.filename)
-        form.file.data.save(query_result_file_path)
+        form.file.data.save(query_result.path)
         # parse json from file
-        with open(query_result_file_path, 'r') as file:
+        with open(query_result.path, 'r') as file:
             query_result_file_content = json.load(file)
         # parse json schema
         with open('app/static/json_schema/nopaque_cqi_py_results_schema.json', 'r') as file:  # noqa