wkelly
wkelly

Reputation: 41

Uploading images with flask on apache server

I'm trying to get flask upload images to a folder but when I try and save it i get an error 13 Permission denied. This is the code that im using:

    if request.method == "POST":

        file = request.files['file']

        picture_path = os.path.join(current_app.root_path, 
        'static/profile_pics', file.filename)

        i = Image.open(file)
        i.save(picture_path)

I'm pretty sure its an issue with permissions on the apache server but I'm not sure how I would fix that.

Upvotes: 0

Views: 245

Answers (1)

akhisyabab
akhisyabab

Reputation: 179

Change mode

sudo chmod -R 777 static/profile_pics

or change owner

sudo chown -R username:group static/profile_pics

hope may help you ;)

Upvotes: 2

Related Questions