import os
import json

from flask import Flask, render_template, request, make_response
from app import app
from werkzeug import secure_filename


UPLOAD_FOLDER = '/static/snapshots/'

app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER


@app.route('/')
def index():
  return render_template('index.html')





@app.route('/upload', methods=['POST'])        
def upload_file():

    data = json.loads(request.data)

    if data["image"]:

        image = data["image"]

        image.save(os.path.join(app.config['UPLOAD_FOLDER'],"latest"))


@@ -157,16 +157,19 @@
 LDER = '
+app
 /static/
@@ -458,25 +458,24 @@
 image%22%5D%0A
-%0A
         
 image.sa
@@ -470,18 +470,17 @@
     
-image.save
+with open
 (os.
@@ -521,16 +521,132 @@
 R'%5D,
+ 
 %22latest
-%22)
+.txt%22), 'w+') as f:%0A            f.write(image)%0A            f.close()%0A%0A%0A        return json.dumps(%7B'status':'success'%7D
 )%0A%0A

save text files working