Created
June 14, 2010 21:30
-
-
Save batok/438336 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@app.route("/", methods=['GET', 'POST']) | |
def upload_file(): | |
if request.method == 'POST': | |
file = request.files['file'] | |
if file and allowed_file(file.filename): | |
app.logger.debug("A valid file {}".format( file.filename)) | |
filename = secure_filename(file.filename) | |
file.save(os.path.join(UPLOAD_FOLDER, filename)) | |
command_line = " montage +frame +shadow +label -tile 10x2 -geometry 50x50+0+0 {0}/*.jpg {0}/mosaic.png".format(UPLOAD_FOLDER) | |
app.logger.debug(command_line) | |
p = subprocess.Popen(commmand_line, shell = True) | |
pid, sts = os.waitpid(p.pid, 0) | |
return redirect(url_for('uploaded_file', | |
filename=filename)) | |
else: | |
return "Invalid file" | |
return ''' | |
<!doctype html> | |
<title>Upload new File</title> | |
<h1>Upload new File</h1> | |
<form action="" method=post enctype=multipart/form-data> | |
<p><input type=file name=file> | |
<input type=submit value=Upload> | |
</form> | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment