Uploaded files should get stored in a database without saving between
loading data into MongoDB without saving while uploading https://pythonhosted.org/Flask-Uploads/
@app.route('/upload', methods=['GET', 'POST'])
def upload():
if request.method == 'POST' and 'photo' in request.files:
filename = photos.save(request.files['photo'])
rec = Photo(filename=filename, user=g.user.id)
rec.store()
flash("Photo saved.")
return redirect(url_for('show', id=rec.id))
return render_template('upload.html')
Aucun commentaire:
Enregistrer un commentaire