from flask import Flask, request, render_template import os app = Flask(__name__) UPLOAD_FOLDER = 'path_to_your_upload_folder' app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER @app.route('/') def index(): return render_template('index.html') @app.route('/upload', methods=['POST']) def upload_file(): if 'file' not in request.files: return 'No file part' file = request.files['file'] if file.filename == '': return 'No selected file' if file: file.save(os.path.join(app.config['UPLOAD_FOLDER'], file.filename)) return 'File uploaded successfully' if __name__ == '__main__': app.run()