aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2010-04-06 15:34:05 +0200
committerNils Adermann <naderman@naderman.de>2010-05-14 01:19:34 +0200
commite4398ef42e8b50978f23cfb6c9145763ab0156ae (patch)
treecd155f9b742f9255bc66722d17f4d3c876144686 /phpBB
parentd19565756add78e246f193b4cffd104836b87fb4 (diff)
downloadforums-e4398ef42e8b50978f23cfb6c9145763ab0156ae.tar
forums-e4398ef42e8b50978f23cfb6c9145763ab0156ae.tar.gz
forums-e4398ef42e8b50978f23cfb6c9145763ab0156ae.tar.bz2
forums-e4398ef42e8b50978f23cfb6c9145763ab0156ae.tar.xz
forums-e4398ef42e8b50978f23cfb6c9145763ab0156ae.zip
[feature/remote_upload-filesize] Also check HTTP content-length before actually starting the file transfer.
PHPBB3-9517
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions_upload.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 40872f0425..51fed45ebd 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -802,6 +802,18 @@ class fileupload
{
$upload_ary['type'] = rtrim(str_replace('content-type: ', '', strtolower($line)));
}
+ else if ($this->max_filesize && stripos($line, 'content-length: ') !== false)
+ {
+ $length = (int) str_replace('content-length: ', '', strtolower($line));
+
+ if ($length && $length > $this->max_filesize)
+ {
+ $max_filesize = get_formatted_filesize($this->max_filesize, false);
+
+ $file = new fileerror(sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit']));
+ return $file;
+ }
+ }
else if (stripos($line, '404 not found') !== false)
{
$file = new fileerror($user->lang[$this->error_prefix . 'URL_NOT_FOUND']);