Zado
asked on
Filesize for multiple files
Hi,
I need simple script to check size of few files, my variables are $f1, $f2, $f3, $f4, how to count total size of those files? Obviously I need to use filesize function, but how?
Thanks for any help.
I need simple script to check size of few files, my variables are $f1, $f2, $f3, $f4, how to count total size of those files? Obviously I need to use filesize function, but how?
Thanks for any help.
try this:
<?php
$filename1 = 'somefile1.txt';
$filename2 = 'somefile2.txt';
$filename3 = 'somefile3.txt';
$filename4 = 'somefile4.txt';
$f1 = filesize($filename1) . 'bytes';
$f2 = filesize($filename2) . 'bytes';
$f3 = filesize($filename3) . 'bytes';
$f4 = filesize($filename4) . 'bytes';
?>
hope that help
<?php
$filename1 = 'somefile1.txt';
$filename2 = 'somefile2.txt';
$filename3 = 'somefile3.txt';
$filename4 = 'somefile4.txt';
$f1 = filesize($filename1) . 'bytes';
$f2 = filesize($filename2) . 'bytes';
$f3 = filesize($filename3) . 'bytes';
$f4 = filesize($filename4) . 'bytes';
?>
hope that help
ASKER
I found solution:
Thanks for your help.
$total= (filesize($f8))+(filesize($f8b))+(filesize($f8c))+(filesize($f8d));
I tried this earlier, but I made mistake with round function, I've done this:$round = round((filesize($inattsize)/1024/1024), 2)."MB"; instead this:
$round = round(($inattsize/1024/1024), 2)."MB";
Thanks for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
Correction for my last comment:
There should be $total instead $inattsize;
Correction for my last comment:
There should be $total instead $inattsize;
http://php.net/manual/en/function.filesize.php