上载1GB或更大的文件 [英] Uploading files of 1GB or more

查看:51
本文介绍了上载1GB或更大的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上传大于1 GB的文件的最佳方法是什么?

What is the best way to upload files larger than 1 GB?

当前情况::我们正在使用flask来部署Web服务器.我们必须上传大于1 GB的文件.以前,我们仅上传几mbs的文件.因此,这不是问题,但是现在对于大于1 GB的文件,无法使用旧的上传方法.服务器刚刚超时.

Current Situation :: We're using flask to deploy webserver. We have to upload files larger than 1 GB. Previously we only uploaded few mbs of files. So, it wasn't a problem but now with files larger than 1 GB the old method of upload is not possible. The server just timeout.

那么有上传文件的好方法吗?

So is there a good way to upload files?

推荐答案

您需要将MAX_CONTENT_LENGTH配置为至少1 GB(可能为填充添加更多).

you need to configure MAX_CONTENT_LENGTH to be at least 1 GB (maybe add more for padding).

from flask import Flask, Request

app = Flask(__name__)
app.config['MAX_CONTENT_LENGTH'] = 1024 * 1024 * 1024

这篇关于上载1GB或更大的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆