我试图限制上传文件的大小,我将app.config ['MAX_CONTENT_LENGTH']设置为所需的最大值,
我使用此代码显示错误。
@app.errorhandler(413)
def request_entity_too_large(error):
return 'File Too Large', 413
Run Code Online (Sandbox Code Playgroud)
使用curl时,错误显示正确。我使用Firefox / Safari进行了检查,在这两种情况下,我均收到浏览器连接断开/重置错误。
火狐浏览器
The connection was reset
The connection to the server was reset while the page was loading.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer's network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the …Run Code Online (Sandbox Code Playgroud) 我有一个基类实例,有一个从基类继承的派生类,我想将基实例转换成派生实例,(如果可能的话,不复制任何内容(可能会向派生类发送基类的引用)) )如何实现?
注意:之所以需要它,是因为我使用的是工厂设计模式,该模式标识需要使用位于基本实例中的参数创建的派生类。
//class A
//class B: public A (pure virtual)
//class C: public B
B BFactory::makeB(A &a) {
int n=a.getN();
if(n==1){
return new C();
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢。