Skip to content
Advertisement

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:

JavaScript

It seems like uploads doesn’t have the necessary permissions to save files? Here’s the configuration I’m using for flask-uploads:

JavaScript

Also, here’s how I save the actual file:

JavaScript

The error is caused by the save line. Any suggestions on how to fix this? Thanks.

Advertisement

Answer

Does your linux user have file permissions on /app/uploads/? Check that using ls -la /app/uploads.

Note that /app would try to write files in the root of the filesystem at /.

If you are looking to write files within your app, use app/uploads instead of /app/uploads/. From the error, it looks like /app simply does not exist and writing to app/uploads is precisely what you wanted to do.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement