def encrypt():
if request.method == 'POST':
# check if the post request has the file part
if 'up_pic' not in request.files:
return "No file selected"
return redirect(request.url)
file = request.files['up_pic']
degree = int(request.form.get('degree'))
pwd = request.form.get('pwd')
# if user does not select file, browser also
# submit a empty part without filename
if file.filename == '':
return "No file selected"
return redirect(request.url)
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
links = [str(os.path.join(app.config['UPLOAD_FOLDER'], filename))]
if request.form['submit']=="enc":
(im,arr,path)=enc.encode(links[0],degree,pwd)
else:
(im,arr,path)=dec.decode(links[0],degree,pwd)
links.append(path)
return render_template("display.html",link=links)
评论列表
文章目录