<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                導入所需模塊 ~~~ from app.admin import admin import os from flask import Flask, request, redirect, url_for from werkzeug import secure_filename from app import app ~~~ 定義修改文件名函數 ~~~ def change_filename(filename): filename = os.path.splitext(filename) new_file = time.strftime('%Y%m%d%H%M%S', time.localtime())+str(uuid.uuid4().hex)+filename[-1] return new_file ~~~ 在配置項中添加配置 ~~~ #允許上傳文件后綴名 ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) #文件保存目錄 UP_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'app/static/admin/uploads/') ~~~ 過濾不允許上傳文件 ~~~ def allowed_file(filename): return '.' in filename and \ filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS ~~~ 上傳方法 ~~~ @admin.route('/upload', methods=['GET', 'POST']) def upload_file(): if request.method == 'POST': file = request.files.get('file') if file and allowed_file(file.filename): filename = secure_filename(file.filename) if not os.path.exists(app.config['UP_DIR']): os.makedirs(app.config['UP_DIR'],755) filename = change_filename(filename) file.save(os.path.join(app.config['UP_DIR'], filename)) return redirect(url_for('uploaded_file', filename=filename)) ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看