/** * ConvertedFile constructor * @param UploadedFile $uploadedFile * @param int $index * @param array $file */ function __construct($uploadedFile, $index, $file) { if (empty($uploadedFile)) { throw new Exception('$uploadedFile parameter can not be empty'); } if (empty($file)) { throw new Exception('$file parameter can not be empty'); } $this->_convertedFileIndex = $index; $this->_uploadedFile = $uploadedFile; $this->_uploadedFileIndex = $uploadedFile->getIndex(); $this->_file = $file; $expectedSize = $this->_uploadedFile->getPackage()->getPackageField(sprintf(PostFields::fileSize, $this->_convertedFileIndex, $this->_uploadedFileIndex)); if ($expectedSize < 2 * 1024 * 1024 * 1024) { $actualSize = $this->_file['size']; if ($expectedSize != $actualSize) { throw new Exception('File is corrupted'); } } $this->_size = intval($expectedSize, 10); }