How to get size of directory in MB Laravel 5?By Hardik Savani | July 23, 2016 | | 4392 Viewer | Category : Laravel
Mostly we require to calculate for uploaded directory size because we can see how much we size allocate in uploaded directory. If you have limited server then you always need to check how much size of data in my folder.
You can also get size of directory that way you can also display on your admin panel. Laravel provide File facade. File facade through we can get folder size in kb or mb or gb etc.
In bellow example i have images directory in public folder. so we can get size for images folder like this way :
$file_size = 0;
foreach( File::allFiles(public_path('images')) as $file)
$file_size += $file->getSize();
$file_size = number_format($file_size / 1048576,2);
- Laravel 5.3 - How to create SEO friendly sluggable URL
- Laravel 5 Facebook authentication using Socialite Package
- How to add charts in Laravel 5 using Highcharts ?
- Laravel 5 - Create modular structure application example using L5Modular package
- Magento 2 - How to solve one or more indexers are invalid by command line?
- AngularJS - simple image upload with preview example in PHP
- How to check column exists or not in table Laravel 5
- How to solve 'There are no commands defined in the "cashier" namespace' in Laravel 5