0

I'm using flask_uploads within a python virtual environment where Flask-Reuploaded is installed. (I mention this as I've noticed a few versions of flask_uploads and have no idea how these differ)

from flask_uploads import configure_uploads, ALL, UploadSet
all = UploadSet('all', ALL)
configure_uploads(app, all)

then in a flask route

form = MyForm()
    if form.validate_on_submit():
        filename = form.all.data.filename
        fname = all.save(form.all.data)

filename and fname will not always be the same. fname appears to replace any spaces in filename with "_". if duplicate filenames are uploaded, fname appears to append "_01", "_02" etc to the filename uploaded.

just wanted to check I'm interpreting the observed behaviour correctly as I couldn't find the relevant source code.

caveat : while I've checked the installed packages within the virtual env I'm using, I was a bit thrown by pip freeze not showing 'flask_uploads' as an installed package. It's remotely possible my 'import flask_uploads' is pulling flask_uploads from somewhere else (?)

for reference, the virtual environment I'm using

pip freeze 
.....
click==8.1.3
colorama==0.4.5
Flask==2.1.2
Flask-Reuploaded==1.2.0
Flask-WTF==1.0.1
importlib-metadata==4.12.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.1
Werkzeug==2.1.2
WTForms==3.0.1
zipp==3.8.0

idk if many ppl aren using Flask-Reuploaded, the volume of tutorials, demos and questions seems small. (hopefully I'm wrong)

CodingMatters
  • 1,275
  • 16
  • 26
  • I'm also working to understand the options checking filetypes uploaded. specifically - I want to accept various versions of excel compatible spreadsheets which can be handled by pandas package. this issue is sufficiently different to justify another SO question. – CodingMatters Jul 15 '22 at 23:56
  • I think I have answered a couple of questions over at https://github.com/jugmac00/flask-reuploaded/issues/131 - could you please update this question here to contain only relevant bits? Will answer it later or tomorrow. – Jürgen Gmach Jul 16 '22 at 06:06
  • 1
    thanks for the answer in github issues. Much appreciated. https://github.com/jugmac00/flask-reuploaded/issues/131 – CodingMatters Jul 17 '22 at 21:30

1 Answers1

0

package owner answered the question in github issues. https://github.com/jugmac00/flask-reuploaded/issues/131

CodingMatters
  • 1,275
  • 16
  • 26