diff --git a/templates/menu/upload.html b/templates/menu/upload.html new file mode 100644 index 0000000..b417223 --- /dev/null +++ b/templates/menu/upload.html @@ -0,0 +1,53 @@ +{% extends 'base.html' %} + +{% block header %} + + Drag and Drop File Upload + + + +{% endblock %} + +{% block content %} + +
+
+ Drop file here or click to upload + + +
+
+ + + + +{% endblock %} \ No newline at end of file diff --git a/upload.py b/upload.py new file mode 100644 index 0000000..43d7b8d --- /dev/null +++ b/upload.py @@ -0,0 +1,39 @@ +from flask import ( + Blueprint, flash, g, redirect, render_template, request, session, url_for +) +from sqlalchemy import create_engine +from sqlalchemy.orm import sessionmaker +from auth import login_required + +from config import CONFIG +from create_db import User, Card + +import nextcloud_client + +bp = Blueprint('upload', __name__, url_prefix='/upload') + +engine = create_engine(CONFIG['DB_CONNECTION']) +dbsessionmaker = sessionmaker(bind=engine) +dbsession = dbsessionmaker() + +@bp.route("/", methods=("GET", "POST")) +def index(): + return render_template("menu/upload.html") + + +@bp.route('/uploader', methods = ['GET', 'POST']) +def upload_file(): + print("heyy") + if request.method == 'POST': + #flask gets the file + upload = request.files["file"] + print("hello") + + #upload to nc + #get public link + + #update db + #predpostavlja title, ir, owner_id, item_location + #card = Card(title=name, interest_rate=-1.0, owner_id=1, item_location=public_link) + #dbsession.add(card) + #dbsession.commit()