|
|
@ -22,7 +22,8 @@ dbsession = dbsessionmaker() |
|
|
|
|
|
|
|
|
|
|
|
nc = nextcloud_client.Client('https://obzorje.kompot.si') |
|
|
|
nc.login('gia', 'gia0000!') |
|
|
|
#print("Loggin in", CONFIG['NC_USER'], CONFIG['NC_PASSWORD']) |
|
|
|
nc.login(CONFIG['NC_USER'],CONFIG['NC_PASSWORD']) |
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/", methods=["GET", "POST"]) |
|
|
@ -42,7 +43,7 @@ def upload_file(): |
|
|
|
filename = secure_filename(upload.filename) |
|
|
|
|
|
|
|
script_path = os.path.dirname(os.path.abspath(__file__)) |
|
|
|
temp_path = script_path + "\\temp\\" |
|
|
|
temp_path = os.path.join(script_path, "temp") |
|
|
|
|
|
|
|
|
|
|
|
#a lot of stuff can wrong here and nobody may know |
|
|
@ -50,8 +51,8 @@ def upload_file(): |
|
|
|
fp.write(upload.stream.read()) |
|
|
|
path = fp.name |
|
|
|
fp.close() |
|
|
|
nc.put_file("/GIA CLOUD/" + filename, "temp\\" + path.split("\\")[-1]) |
|
|
|
os.remove(fp.name) |
|
|
|
nc.put_file("/GIA CLOUD/" + filename, path) |
|
|
|
os.remove(path) |
|
|
|
|
|
|
|
#get public link |
|
|
|
public_link = nc.share_file_with_link("/GIA CLOUD/" + filename).get_link()+"/download/"+filename |
|
|
@ -61,4 +62,4 @@ def upload_file(): |
|
|
|
dbsession.add(card) |
|
|
|
dbsession.commit() |
|
|
|
|
|
|
|
return render_template("menu/upload.html", message=message, user_id=user_id, username=username) |
|
|
|
return render_template("menu/upload.html", message=message, user_id=user_id, username=username) |