import flask, os, sqlite3
from flask import render_template, request
from flask import send_from_directory
from werkzeug.utils import secure_filename

if not os.path.isfile('db.sqlite3'):
    db = sqlite3.connect('db.sqlite3')
    db.execute('CREATE TABLE photos(photo TEXT)')
    db.commit()
    db.close()

app = flask.Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def home():
    if request.method == 'POST' and \
       request.files and 'photo' in request.files:
        photo = request.files['photo']
        filename = secure_filename(photo.filename)
        path = os.path.join('uploads', filename)
        photo.save(path)
        db = sqlite3.connect('db.sqlite3')
        db.execute('INSERT INTO photos(photo) VALUES (?)', (filename,))
        db.commit()
        db.close()
    return render_template('form_with_file_upload.html')

@app.route('/view')
def view():
    db = sqlite3.connect('db.sqlite3')
    cur = db.execute('SELECT photo FROM photos')
    photos = []
    for row in cur:
        photos.append(row[0])
    db.close()
    return render_template('view_file_uploads.html', photos=photos)

@app.route('/photos/<filename>')
def get_file(filename):
    return send_from_directory('uploads', filename)

if __name__ == '__main__':
    app.run()
8b0ed3db7a274ab9dad79c35562d2d090ed6c651
<mask token>


@app.route('/', methods=['GET', 'POST'])
def home():
    if request.method == 'POST' and request.files and 'photo' in request.files:
        photo = request.files['photo']
        filename = secure_filename(photo.filename)
        path = os.path.join('uploads', filename)
        photo.save(path)
        db = sqlite3.connect('db.sqlite3')
        db.execute('INSERT INTO photos(photo) VALUES (?)', (filename,))
        db.commit()
        db.close()
    return render_template('form_with_file_upload.html')


@app.route('/view')
def view():
    db = sqlite3.connect('db.sqlite3')
    cur = db.execute('SELECT photo FROM photos')
    photos = []
    for row in cur:
        photos.append(row[0])
    db.close()
    return render_template('view_file_uploads.html', photos=photos)


@app.route('/photos/<filename>')
def get_file(filename):
    return send_from_directory('uploads', filename)


<mask token>

<mask token>
if not os.path.isfile('db.sqlite3'):
    db = sqlite3.connect('db.sqlite3')
    db.execute('CREATE TABLE photos(photo TEXT)')
    db.commit()
    db.close()
<mask token>


@app.route('/', methods=['GET', 'POST'])
def home():
    if request.method == 'POST' and request.files and 'photo' in request.files:
        photo = request.files['photo']
        filename = secure_filename(photo.filename)
        path = os.path.join('uploads', filename)
        photo.save(path)
        db = sqlite3.connect('db.sqlite3')
        db.execute('INSERT INTO photos(photo) VALUES (?)', (filename,))
        db.commit()
        db.close()
    return render_template('form_with_file_upload.html')


@app.route('/view')
def view():
    db = sqlite3.connect('db.sqlite3')
    cur = db.execute('SELECT photo FROM photos')
    photos = []
    for row in cur:
        photos.append(row[0])
    db.close()
    return render_template('view_file_uploads.html', photos=photos)


@app.route('/photos/<filename>')
def get_file(filename):
    return send_from_directory('uploads', filename)


if __name__ == '__main__':
    app.run()

<mask token>
if not os.path.isfile('db.sqlite3'):
    db = sqlite3.connect('db.sqlite3')
    db.execute('CREATE TABLE photos(photo TEXT)')
    db.commit()
    db.close()
app = flask.Flask(__name__)


@app.route('/', methods=['GET', 'POST'])
def home():
    if request.method == 'POST' and request.files and 'photo' in request.files:
        photo = request.files['photo']
        filename = secure_filename(photo.filename)
        path = os.path.join('uploads', filename)
        photo.save(path)
        db = sqlite3.connect('db.sqlite3')
        db.execute('INSERT INTO photos(photo) VALUES (?)', (filename,))
        db.commit()
        db.close()
    return render_template('form_with_file_upload.html')


@app.route('/view')
def view():
    db = sqlite3.connect('db.sqlite3')
    cur = db.execute('SELECT photo FROM photos')
    photos = []
    for row in cur:
        photos.append(row[0])
    db.close()
    return render_template('view_file_uploads.html', photos=photos)


@app.route('/photos/<filename>')
def get_file(filename):
    return send_from_directory('uploads', filename)


if __name__ == '__main__':
    app.run()

import flask, os, sqlite3
from flask import render_template, request
from flask import send_from_directory
from werkzeug.utils import secure_filename
if not os.path.isfile('db.sqlite3'):
    db = sqlite3.connect('db.sqlite3')
    db.execute('CREATE TABLE photos(photo TEXT)')
    db.commit()
    db.close()
app = flask.Flask(__name__)


@app.route('/', methods=['GET', 'POST'])
def home():
    if request.method == 'POST' and request.files and 'photo' in request.files:
        photo = request.files['photo']
        filename = secure_filename(photo.filename)
        path = os.path.join('uploads', filename)
        photo.save(path)
        db = sqlite3.connect('db.sqlite3')
        db.execute('INSERT INTO photos(photo) VALUES (?)', (filename,))
        db.commit()
        db.close()
    return render_template('form_with_file_upload.html')


@app.route('/view')
def view():
    db = sqlite3.connect('db.sqlite3')
    cur = db.execute('SELECT photo FROM photos')
    photos = []
    for row in cur:
        photos.append(row[0])
    db.close()
    return render_template('view_file_uploads.html', photos=photos)


@app.route('/photos/<filename>')
def get_file(filename):
    return send_from_directory('uploads', filename)


if __name__ == '__main__':
    app.run()

import flask, os, sqlite3
from flask import render_template, request
from flask import send_from_directory
from werkzeug.utils import secure_filename

if not os.path.isfile('db.sqlite3'):
    db = sqlite3.connect('db.sqlite3')
    db.execute('CREATE TABLE photos(photo TEXT)')
    db.commit()
    db.close()

app = flask.Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def home():
    if request.method == 'POST' and \
       request.files and 'photo' in request.files:
        photo = request.files['photo']
        filename = secure_filename(photo.filename)
        path = os.path.join('uploads', filename)
        photo.save(path)
        db = sqlite3.connect('db.sqlite3')
        db.execute('INSERT INTO photos(photo) VALUES (?)', (filename,))
        db.commit()
        db.close()
    return render_template('form_with_file_upload.html')

@app.route('/view')
def view():
    db = sqlite3.connect('db.sqlite3')
    cur = db.execute('SELECT photo FROM photos')
    photos = []
    for row in cur:
        photos.append(row[0])
    db.close()
    return render_template('view_file_uploads.html', photos=photos)

@app.route('/photos/<filename>')
def get_file(filename):
    return send_from_directory('uploads', filename)

if __name__ == '__main__':
    app.run()