Open GoogleCodeExporter opened 9 years ago
If you are on a 64 bit system, filesize will report the proper size value. The
quick workaround is changing the get_real_size() function in
includes/functions.php:
function get_real_size($file)
{
clearstatcache();
$file = filesize($file);
return $file;
}
Original comment by kosars...@gmail.com
on 25 Mar 2013 at 1:32
[deleted comment]
I was having the same problem though I am using r405
I solved it with the following changes
from line 430 of functions.php in includes
for functions format_file_size() I made changes to recognize if the input was
numeric if not numeric
display a ?
on line 437 replacing
echo $file . ' Byte';
with
echo (ctype_digit($file))? $file . ' Byte' : ' ? ' ; /* No digits so put a ?
much better than just seeing Byte */
for function get_real_size() I replaced the function with the function below
which includes a check for the returned value being digits and revert to
filesize if not.
function get_real_size($file)
{
clearstatcache();
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
if (class_exists("COM")) {
$fsobj = new COM('Scripting.FileSystemObject');
$f = $fsobj->GetFile(realpath($file));
$ff = $f->Size;
}
else {
$ff = trim(exec("for %F in (\"" . $file . "\") do @echo %~zF"));
}
}
elseif (PHP_OS == 'Darwin') {
$ff = trim(shell_exec("stat -f %z " . escapeshellarg($file)));
}
elseif ((PHP_OS == 'Linux') || (PHP_OS == 'FreeBSD') || (PHP_OS == 'Unix') || (PHP_OS == 'SunOS')) {
$ff = trim(shell_exec("stat -c%s " . escapeshellarg($file)));
}
else {
$ff = filesize($file);
}
/* above returns '' on my server so I added the items below to check */
if( !ctype_digit($ff))$ff=filesize($file); /* returned value not a number so try filesize() */
return $ff;
}
Alan
Original comment by AlanReib...@googlemail.com
on 23 Apr 2013 at 10:29
Thank you Alan!!! This is a great solution! It has been applied and the new
version r412 includes it (and your name as the author).
You have solved a big issue :D
Original comment by i...@subwaydesign.com.ar
on 27 Apr 2013 at 6:37
r412 file download 0kb please solved this problem
Original comment by bdwebc...@gmail.com
on 17 Sep 2013 at 8:34
Original issue reported on code.google.com by
sanjayrath
on 9 Mar 2013 at 2:53Attachments: