How to get size of directory in MB Laravel 5?By Hardik Savani | July 23, 2016 | | 2064 Viewer | Category : Laravel
Share this post:
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);
- How to check file size when select multiple file validation using Jquery?
- How to upload image with validation in PHP Codeigniter?
- How to get hours difference between two dates in laravel?
- How to create snippets in sublime ?
- Laravel 5 - Barcode generator example using milon/barcode package
- Jquery - How to copy text to clipboard without flash example ?
- Jquery notification popup box example using toastr JS plugin with demo
- Laravel 5 - Grayscale Image Generate Example from scratch