mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/14431] Remote avatar uploading
Fixed content length bug Ran composer update PHPBB3-14431
This commit is contained in:
parent
cec63974c3
commit
49dd9f0219
1 changed files with 7 additions and 1 deletions
|
@ -115,13 +115,19 @@ class remote extends base
|
||||||
return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'NOT_UPLOADED'));
|
return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'NOT_UPLOADED'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($remote_max_filesize && $response->getContentType() > $remote_max_filesize)
|
$content_length = $response->getContentLength();
|
||||||
|
if ($remote_max_filesize && $content_length > $remote_max_filesize)
|
||||||
{
|
{
|
||||||
$max_filesize = get_formatted_filesize($remote_max_filesize, false);
|
$max_filesize = get_formatted_filesize($remote_max_filesize, false);
|
||||||
|
|
||||||
return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit']));
|
return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($content_length == 0)
|
||||||
|
{
|
||||||
|
return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'EMPTY_REMOTE_DATA');
|
||||||
|
}
|
||||||
|
|
||||||
$data = $response->getBody();
|
$data = $response->getBody();
|
||||||
|
|
||||||
$filename = tempnam(sys_get_temp_dir(), unique_id() . '-');
|
$filename = tempnam(sys_get_temp_dir(), unique_id() . '-');
|
||||||
|
|
Loading…
Add table
Reference in a new issue