How to allow users access to overwrite files on server Python Flask?

import BytesIO
import base64
import maptlotlib.pyplot as plt

# Make your plot like you normally do.
plt.plot([1, 2, 3], [4, 5, 6])  # Simple example.

# Put plot in memory.
handle = BytesIO()
plt.savefig(handle, format='png')

# Encode.
figdata_png = base64.b64encode(handle.getvalue()).decode('utf8')
from flask import render_template

render_template('index.html', plot=plot)