Beispiel #1
0
def FileShare():
    ids = request.values.get('ids')
    sqlresult = sql.getShareFileInfo(ids)
    return render_template("downFileShare.html",
                           needvie=('yes' if sqlresult[2] != '' else 'no'),
                           filename=os.path.split(sqlresult[1])[1],
                           ids=ids,
                           filesize=getFileSize(sqlresult[1]))
Beispiel #2
0
def DownFileShare():
    ids = request.values.get('ids')
    sqlresult = sql.getShareFileInfo(ids)
    if request.values.get('filevie', '') == sqlresult[2]:
        fileName = sqlresult[1]
        response = make_response(
            send_from_directory(os.path.split(fileName)[0],
                                os.path.split(fileName)[1],
                                as_attachment=True,
                                attachment_filename='123'))
        response.headers[
            "Content-Disposition"] = "attachment; filename={}".format(
                os.path.split(fileName)[1].encode().decode('latin-1'))
        return response
    else:
        return '提取码错误!'