Created
December 29, 2017 03:33
-
-
Save thamizhchelvan/05c635ca0ed9f8b3b28c2665adeee986 to your computer and use it in GitHub Desktop.
The server code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from flask import Flask, request, render_template, url_for, redirect | |
app = Flask(__name__) | |
@app.route("/") | |
def fileFrontPage(): | |
return render_template('fileform.html') | |
@app.route("/handleUpload", methods=['POST']) | |
def handleFileUpload(): | |
if 'photo' in request.files: | |
photo = request.files['photo'] | |
if photo.filename != '': | |
photo.save(os.path.join('C:/Users/Public/Pictures', photo.filename)) | |
return redirect(url_for('fileFrontPage')) | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment