def upload():
print('Hello world!')
# Get the name of the uploaded file
#file = request.files['uploadFile']
file = request.files['uploadFile']
# Check if the file is one of the allowed types/extensions
if file and allowed_file(file.filename):
# Make the filename safe, remove unsupported chars
filename = secure_filename(file.filename)
# Move the file form the temporal folder to
# the upload folder we setup
print("filename: ", filename)
print("file: ", file)
filepath=os.path.join(app.config['UPLOAD_FOLDER'], filename)
file.save(filepath)
return findSimilar(imagename=filename)
# This route is expecting a parameter containing the name
# of a file. Then it will locate that file on the upload
# directory and show it on the browser, so if the user uploads
# an image, that image is going to be show after the upload
#@app.route('/uploads/<filename>')
#def get_uploadedFile(filename):
# return send_from_directory(app.config['UPLOAD_FOLDER'], filename)
# @app.route('/uploads')
# def uploads():
# return render_template('uploads.html')
评论列表
文章目录