Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Gets file size
<?php filesize(string $filename): int|false
<?php public function size($path)
{
return filesize($path);
}
<?php public function size()
{
return filesize($this->path);
}
<?php $path = $this->basePath();
if (file_exists($path) && is_file($path)) {
return filesize($path);
}
return false;
<?php function filesize(...$arguments)
{
if ( ! is_mocked('filesize')) {
return \filesize(...$arguments);
}
return return_mocked_value('filesize');
<?php $location = $this->prefixer->prefixPath($path);
error_clear_last();
if (is_file($location) && ($fileSize = @filesize($location)) !== false) {
return new FileAttributes($path, $fileSize);
}
<?php public function it_gets_file_size_in_bytes()
{
$container = $this->container;
$size = filesize($fixture = __DIR__.'/__fixtures__/container/a.txt');
copy($fixture, Storage::disk('test')->getAdapter()->getPathPrefix().'test.txt');
$asset = (new Asset)
<?php return 1;
}
if (filesize($this->file) === 0) {
file_put_contents($this->file, "{\n}\n");
}
<?php $accept = function ($response) use ($cache, $package, $fileName, &$urls) {
$url = reset($urls);
$cacheKey = $url['cacheKey'];
FileDownloader::$downloadMetadata[$package->getName()] = @filesize($fileName) ?: $response->getHeader('Content-Length') ?: '?';
if ($cache && !$cache->isReadOnly()) {
$this->lastCacheWrites[$package->getName()] = $cacheKey;
<?php if (!$this->doTree($dir.'/'.$file, $array)) {
return false;
}
} elseif (is_file($dir.'/'.$file) && filesize($dir.'/'.$file)) {
$array[$dir][$file] = md5_file($dir.'/'.$file);
}
}
<?php return $this->directorySize($path);
}
return filesize($path);
}
<?php private function filesAreEqual($a, $b)
{
if (filesize($a) !== filesize($b)) {
return false;
}
<?php @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
}
}
<?php throw new RuntimeException('Unable to create a temporary directory');
}
file_put_contents($tmpPath, $part->getBody());
$file = new UploadedFile($tmpPath, filesize($tmpPath), UPLOAD_ERR_OK, $part->getFileName(), $part->getMimeType());
self::parseKeyAndInsertValueInArray($files, $part->getName(), $file);
} else {