from flask import Flask, render_template, request, redirect, url_for
from os import path
from werkzeug.utils import secure_filename
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html', title = 'tuomasi Home')
@app.route('/upload', methods=['GET', 'POST'])
def upload():
if request.method == 'POST':
f = request.files['file']
basepath = path.abspath(path.dirname(__file__))
upload_path = path.join(basepath, 'static\uploads')
f.save(upload_path, secure_filename(f.filename))
return redirect(url_for('upload'))
return render_template('upload.html')
if name == '__main__':
app.run(debug = True)
我的问题是:当我上传一个文件的时候,提示IOError: [Errno 13] Permission denied,无论我怎样修改目录,都是这个错误,使用管理员权限运行cmd也不行,求大神解答