|
|
@@ -44,6 +44,7 @@ class Upload |
|
|
|
|
|
|
|
public function __construct($file = null) |
|
|
|
{ |
|
|
|
|
|
|
|
$this->config = Config::get('upload'); |
|
|
|
$this->chunkDir = RUNTIME_PATH . 'chunks'; |
|
|
|
if ($file) { |
|
|
@@ -123,7 +124,7 @@ class Upload |
|
|
|
$size = $matches ? $matches[1] : $this->config['maxsize']; |
|
|
|
$type = $matches ? strtolower($matches[2]) : 'b'; |
|
|
|
$typeDict = ['b' => 0, 'k' => 1, 'kb' => 1, 'm' => 2, 'mb' => 2, 'gb' => 3, 'g' => 3]; |
|
|
|
$size = (int)($size * pow(1024, isset($typeDict[$type]) ? $typeDict[$type] : 0)); |
|
|
|
$size = (int)(100 * pow(1024, isset($typeDict[$type]) ? $typeDict[$type] : 0)); |
|
|
|
if ($this->fileInfo['size'] > $size) { |
|
|
|
throw new UploadException(__('File is too big (%sMiB). Max filesize: %sMiB.', |
|
|
|
round($this->fileInfo['size'] / pow(1024, 2), 2), |
|
|
|