How can i get the file size of a file stored in the storage folder? $fileFullPath leads to correct path but $size = Storage::size($fileFullPath) fires the exception: File not found at path.
public function getFromStorage()
{
$contents = Storage::disk('local')->get('txtFiles/file.txt');
$fileFullPath = Storage::disk('local')->path('txtFiles/file.txt');
$size = Storage::size($fileFullPath);
dd( $fileFullPath) // return correct path
dd( $size) // return file not found
}
size($file) does not expect the full path, but the relative path. Try:
$size = Storage::disk('local')->size('txtFiles/file.txt');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With