Пример #1
0
	/**
	 * Get the filesize of this file object, as either raw bytes or a formatted string.
	 *
	 * @param bool $formatted
	 *
	 * @return string|int
	 */
	public function getFilesize($formatted = false) {
		$filename = $this->getFilename();

		if(($f = $this->_ftp->getFileSize($filename)) == ''){
			// The cached query failed, lookup on the actual FTP server.
			$f = ftp_size($this->_ftp->getConn(), $filename);

			$this->_ftp->setFileSize($filename, $f);
		}

		if($f == -1){
			return 0;
		}

		return ($formatted) ? Filestore\format_size($f, 2) : $f;
	}
Пример #2
0
	public function getFilesize($formatted = false) {
		$f = filesize($this->_filename);
		return ($formatted) ? Filestore\format_size($f, 2) : $f;
	}