flask dropzone大文件(flask 77)

2019-08-20 16:31:54 浏览数 (1)

import os

from flask import Flask, render_template, request from flask_dropzone import Dropzone

basedir = os.path.abspath(os.path.dirname(file))

app = Flask(name)

app.config.update( UPLOADED_PATH=os.path.join(basedir, 'uploads'), # Flask-Dropzone config: DROPZONE_MAX_FILE_SIZE=1024, # set max size limit to a large number, here is 1024 MB DROPZONE_TIMEOUT=5 * 60 * 1000 # set upload timeout to a large number, here is 5 minutes )

dropzone = Dropzone(app)

@app.route('/', methods=['POST', 'GET']) def upload(): if request.method == 'POST': f = request.files.get('file') f.save(os.path.join(app.config['UPLOADED_PATH'], f.filename)) return render_template('index.html')

if name == 'main': app.run(debug=True)

0 人点赞