Questions tagged [flask-uploads]

Flask-Uploads allows your application to flexibly and efficiently handle file uploading and serving the uploaded files. You can create different sets of uploads - one for document attachments, one for photos, etc. - and the application can be configured to save them all in different places and to generate different URLs for them.

77 questions
51
votes
6 answers

flask_uploads: ImportError: cannot import name 'secure_filename'

I want to create a form that allows to send a picture with a description using flask forms. I tried to use this video: https://www.youtube.com/watch?v=Exf8RbgKmhM but I had troubles when launching app.py: ➜ website git:(master) ✗ python3.6…
Santeau
  • 839
  • 3
  • 13
  • 23
15
votes
3 answers

Flask-Uploads IOError: [Errno 2] No such file or directory

So, I've been trying to add an image uploader to my code, but I've been running into issues. Even though I thought I had my upload_folder configured properly, I keep getting errors like: IOError: [Errno 2] No such file or directory:…
dizzy
  • 1,177
  • 2
  • 12
  • 34
13
votes
4 answers

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

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…
Alison S
  • 1,759
  • 1
  • 14
  • 28
8
votes
3 answers

cannot import name 'secure_filename' from 'werkzeug'

I'm trying to import secure_filename from werkzeug.utils and it shoot an error. It works fine under my base virtual env. code: # Flask packages from flask import Flask, render_template, request, session, redirect, flash, send_file from…
louis lau
  • 259
  • 2
  • 3
  • 5
8
votes
2 answers

Upload an Image and Display it back as a response using Flask

I'm a beginner in front end development, and have to do a small web app in Flask for a project. I have written a Flask app that lets you upload an image using HTML Forms and then displays the image back to the user when you hit Upload. I need to…
Richa Netto
  • 305
  • 2
  • 4
  • 8
6
votes
2 answers

Rejecting files greater than a certain amount with Flask-Uploads?

Flask recommends the Flask-Uploads module for handling uploads. I'd like to reject any file over a certain size. There are a few solutions floating around: From the docs: In addition, you can also use patch_request_class to patch your app’s…
rublex
  • 1,893
  • 5
  • 27
  • 45
6
votes
3 answers

upload files using flask-uploads

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,…
22decembre
  • 549
  • 4
  • 8
  • 17
5
votes
0 answers

Pre populate Flask-WTF FileField when file was already uploaded

here is what I would like to achieve: I would like to be able to edit a database entry through a form which contains multiple different types of Fields (BooleandFields, StringFields etc.) and in these are two flask_wtf FileFields that I would like…
ViVittori
  • 103
  • 1
  • 6
5
votes
3 answers

Flask-Uploads Permission Denied

I'm using Flask Uploads for an upload form in my Flask application. However, whenever I try to save a file I get this error: File "/Users/Documents/virtual_environment/bin/../lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError:…
kevin.w.johnson
  • 1,684
  • 3
  • 18
  • 37
5
votes
2 answers

Flask File Handling: Werkzeug Vs Flask-Uploads

I am trying to decide how to implement image uploading functionality on my flask app. I am currently using Flask-Uploads to get the job done and it seems to work pretty well. However, I have no idea if it is very secure, which could be a huge…
Harrison
  • 830
  • 1
  • 15
  • 28
3
votes
1 answer

How to import flask-reuploaded module

I was trying to use flask-uploads module but I found in the thread: Flask-Uploads Module That I should go with flask-reuploaded module to fix the error: import name 'secure_filename' from 'werkzeug'…
Gabriel
  • 31
  • 1
3
votes
1 answer

Flask-Uploads URL is always a 404

I'm using Flask-Uploads to upload a file and output the URL. However, for some reason the URL always points to a 404! I can see the file in the correct folder, but the URL seems to not be able to find it. Here are the configurations I'm…
kevin.w.johnson
  • 1,684
  • 3
  • 18
  • 37
2
votes
2 answers

TypeError: storage must be a werkzeug.FileStorage in Flask Upload

So what I did is that I tried to run my flask app but suddenly I got a error which is TypeError: storage must be a werkzeug.FileStorage This is the code that I use... init.py # IMPORT from flask import Flask from flask_sqlalchemy import…
Mori
  • 23
  • 4
2
votes
1 answer

Flask-Uploads : how to use with application factory

I am trying to implement Flask-Uploads in my project. However, I am having trouble because I am using an application factory function and cannot access the UploadSets from other files in the app! FILE: app/__init__.py from flask_uploads import…
Daniel da Rocha
  • 887
  • 13
  • 26
2
votes
1 answer

Flask: force download pdf files to open in browser

I'm trying to download a PDF file using flask but I don't want the file to download as an attachment. I simply want it to appear in the user's browser as a separate webpage. I've tried passing the as_attachment=False option to the…
Johnny Metz
  • 5,977
  • 18
  • 82
  • 146
1
2 3 4 5 6