Flask: Ioerror When Saving Uploaded Files
I am learning Flask and am attempting to work through the uploading files pattern documented here: http://flask.pocoo.org/docs/patterns/fileuploads/. I am working in Firefox 12 on
Solution 1:
Why not try this, it works for me.
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
UPLOAD_FOLDER = os.path.join(APP_ROOT, 'static/uploads')
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
Solution 2:
The slash at the beginning of '/uploads' makes the path specification absolute: the leading slash represents the root of the filesystem hierarchy. While that might not be exactly how things work on Windows, it makes sense for Python to understand it this way as its path-handling functions are cross-platform.
The forms 'uploads/' and './uploads/' are equivalent and they are relative.
Note that relative paths are relative to the current directory, which you don't necessarily control, so you might want to specify an absolute path for UPLOAD_FOLDER.
Post a Comment for "Flask: Ioerror When Saving Uploaded Files"