I am doing a web application with flask and in one part an image is uploaded but when I do the process I get the error that I do not have permissions, I already executed as administrator the windows CMD, I gave it permissions of the folder in the properties and it's still coming out. Does anyone know the solution ?, I show the code I'm doing:
console:
PermissionError: [Errno 13] Permission denied: 'C:\Users\useradmin\Documents\python\proyecto\web/static/assets'
uploadfiles.py
import os
import smtplib
from flask import json, session, request
from werkzeug.utils import secure_filename
ROOT_ABSOLUTE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
UPLOAD_FOLDER = ROOT_ABSOLUTE_PATH+"/static/assets"
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
class FilesPrueba():
def __init__(self, request_file):
self.request_file = request_file
def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
def uploas_images(self)
file = self.request_file.files['files[]']
if file and FilesPrueba.allowed_file(file.filename):
filename = secure_filename(file.filename)
print('filename: ', filename)
file.save(os.path.join(UPLOAD_FOLDER), filename)
#.....
thank you very much.