def upload():
# Create instance of long task
if 'file' not in request.files:
print "No file found"
return render_template('index.html')
file = request.files['file']
print file
if file.filename == '':
flash('No file selected!')
return redirect(request.url)
if file and valid_image(file.filename):
filename = secure_filename(file.filename)
out_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)
file.save(out_path)
return render_template("index.html", image_name=filename)
评论列表
文章目录