basedir = os.path.abspath(os.path.dirname(__file__)) file.save(os.path.join(basedir, app.config['UPLOAD_FOLDER'], filename))