getIniBytes() публичный статический Метод

Return bytes from php.ini value
public static getIniBytes ( string $iniName = '', string $val = '' ) : number
$iniName string
$val string
Результат number
 /**
  * Create new file and write into it from file pointer.
  * Return new file path or false on error.
  *
  * @param resource $fp   file pointer
  * @param string   $dir  target dir path
  * @param string   $name file name
  * @param array    $stat file stat (required by some virtual fs)
  *
  * @return bool|string
  *
  * @author Dmitry (dio) Levashov
  **/
 protected function _save($fp, $path, $name, $stat)
 {
     if ($name !== '') {
         $path .= '/' . $name;
     }
     list($parentId, $itemId, $parent) = $this->_gd_splitPath($path);
     if ($name === '') {
         $stat['iid'] = $itemId;
     }
     if (!$stat || empty($stat['iid'])) {
         $opts = ['q' => sprintf('trashed=false and "%s" in parents and name="%s"', $parentId, $name), 'fields' => self::FETCHFIELDS_LIST];
         $srcFile = $this->_gd_query($opts);
         $srcFile = empty($srcFile) ? null : $srcFile[0];
     } else {
         $srcFile = $this->_gd_getFile($path);
     }
     try {
         $mode = 'update';
         $mime = isset($stat['mime']) ? $stat['mime'] : '';
         $file = new Google_Service_Drive_DriveFile();
         if ($srcFile) {
             $mime = $srcFile->getMimeType();
         } else {
             $mode = 'insert';
             $file->setName($name);
             $file->setParents([$parentId]);
         }
         if (!$mime) {
             $mime = self::mimetypeInternalDetect($name);
         }
         if ($mime === 'unknown') {
             $mime = 'application/octet-stream';
         }
         $file->setMimeType($mime);
         $size = 0;
         if (isset($stat['size'])) {
             $size = $stat['size'];
         } else {
             $fstat = fstat($fp);
             if (!empty($fstat['size'])) {
                 $size = $fstat['size'];
             }
         }
         // set chunk size (max: 100MB)
         $chunkSizeBytes = 100 * 1024 * 1024;
         if ($size > 0) {
             $memory = elFinder::getIniBytes('memory_limit');
             if ($memory) {
                 $chunkSizeBytes = min([$chunkSizeBytes, intval($memory / 4 / 256) * 256]);
             }
         }
         if ($size > $chunkSizeBytes) {
             $client = $this->client;
             // Call the API with the media upload, defer so it doesn't immediately return.
             $client->setDefer(true);
             if ($mode === 'insert') {
                 $request = $this->service->files->create($file, ['fields' => self::FETCHFIELDS_GET]);
             } else {
                 $request = $this->service->files->update($srcFile->getId(), $file, ['fields' => self::FETCHFIELDS_GET]);
             }
             // Create a media file upload to represent our upload process.
             $media = new Google_Http_MediaFileUpload($client, $request, $mime, null, true, $chunkSizeBytes);
             $media->setFileSize($size);
             // Upload the various chunks. $status will be false until the process is
             // complete.
             $status = false;
             while (!$status && !feof($fp)) {
                 elFinder::extendTimeLimit();
                 // read until you get $chunkSizeBytes from TESTFILE
                 // fread will never return more than 8192 bytes if the stream is read buffered and it does not represent a plain file
                 // An example of a read buffered file is when reading from a URL
                 $chunk = $this->_gd_readFileChunk($fp, $chunkSizeBytes);
                 $status = $media->nextChunk($chunk);
             }
             // The final value of $status will be the data from the API for the object
             // that has been uploaded.
             if ($status !== false) {
                 $obj = $status;
             }
             $client->setDefer(false);
         } else {
             $params = ['data' => stream_get_contents($fp), 'uploadType' => 'media', 'fields' => self::FETCHFIELDS_GET];
             if ($mode === 'insert') {
                 $obj = $this->service->files->create($file, $params);
             } else {
                 $obj = $this->service->files->update($srcFile->getId(), $file, $params);
             }
         }
         if ($obj instanceof Google_Service_Drive_DriveFile) {
             return $this->_joinPath($parent, $obj->getId());
         } else {
             return false;
         }
     } catch (Exception $e) {
         return $this->setError('GoogleDrive error: ' . $e->getMessage());
     }
 }