WebGUI now adds a warning to the log when a file upload is too big, and gracefully recovers from the problem.
This commit is contained in:
parent
a9ef84f691
commit
96b1f91f37
2 changed files with 7 additions and 0 deletions
|
|
@ -514,6 +514,7 @@ If a web image (gif, png, jpg, jpeg) is being uploaded it will be resized if it
|
||||||
|
|
||||||
sub save {
|
sub save {
|
||||||
my ($type, $file, $filename, $bytesread, $buffer, $urlizedFilename, $path);
|
my ($type, $file, $filename, $bytesread, $buffer, $urlizedFilename, $path);
|
||||||
|
return "" if ($session{header}{status} =~ /^413/);
|
||||||
$filename = $session{cgi}->upload($_[1]);
|
$filename = $session{cgi}->upload($_[1]);
|
||||||
if (defined $filename) {
|
if (defined $filename) {
|
||||||
if ($filename =~ /([^\/\\]+)$/) {
|
if ($filename =~ /([^\/\\]+)$/) {
|
||||||
|
|
|
||||||
|
|
@ -439,6 +439,12 @@ sub open {
|
||||||
### CGI object
|
### CGI object
|
||||||
$CGI::POST_MAX=1024 * $session{setting}{maxAttachmentSize};
|
$CGI::POST_MAX=1024 * $session{setting}{maxAttachmentSize};
|
||||||
$session{cgi} = CGI->new();
|
$session{cgi} = CGI->new();
|
||||||
|
if ($session{cgi}->cgi_error =~ /^413/) {
|
||||||
|
$session{header}{status} = $session{cgi}->cgi_error;
|
||||||
|
WebGUI::ErrorHandler::warn("File upload too big. May need to adjust Max File Size setting.");
|
||||||
|
$CGI::POST_MAX=-1;
|
||||||
|
$session{cgi} = CGI->new();
|
||||||
|
}
|
||||||
###----------------------------
|
###----------------------------
|
||||||
### header variables
|
### header variables
|
||||||
$session{header}{mimetype} = 'text/html';
|
$session{header}{mimetype} = 'text/html';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue