flask-uploads

File not uploading with Flask-wtforms in cookiecutter-flask app

耗尽温柔 提交于 2019-12-10 12:33:17
问题 I am having a problem getting a file upload to work in a cookiecutter-flask app (v. 0.10.1). Right now, it is not saving the file uploaded. Cookiecutter-Flask by default installs WTForms and Flask-WTForms. I have tried adding Flask-Uploads to this but I'm not convinced that module adds anything at this point so I have uninstalled it. This is the Flask-WTF file upload documentation: http://flask-wtf.readthedocs.io/en/latest/form.html#module-flask_wtf.file The main difference between the

upload files using flask-uploads

不打扰是莪最后的温柔 提交于 2019-12-06 04:06:11
问题 I am trying to upload files using the flask-uploads extension. The problem is that, each time it seems I find a solution, I fund an other problem, and I feel the documentation cryptic. Here is the code : from flask.ext.uploads import UploadSet, IMAGES, configure_uploads import os from werkzeug import secure_filename photos = UploadSet('photos', IMAGES) configure_uploads(app, photos) @app.route('/edit_book', methods = ['GET', 'POST']) def edit_book(): form = BookForm() if form.validate_on

upload files using flask-uploads

你说的曾经没有我的故事 提交于 2019-12-04 09:06:31
I am trying to upload files using the flask-uploads extension. The problem is that, each time it seems I find a solution, I fund an other problem, and I feel the documentation cryptic. Here is the code : from flask.ext.uploads import UploadSet, IMAGES, configure_uploads import os from werkzeug import secure_filename photos = UploadSet('photos', IMAGES) configure_uploads(app, photos) @app.route('/edit_book', methods = ['GET', 'POST']) def edit_book(): form = BookForm() if form.validate_on_submit(): b.summary = form.summary.data if request.method == 'POST': try: secure_filename = photos.save