Currently I am grabbing the file names by using straight PHP code and
opendir("./movies");
My problem is I have files over 2 gigs and I am getting errors galore AND I can't use pagination to lower the amount shown on each page... I did find a snippet to display filesize over 2GB but now I am having an issue displaying fileatime with files over 2GB
function showsize($file) {
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
if (class_exists("COM")) {
$fsobj = new COM('Scripting.FileSystemObject');
$f = $fsobj->GetFile(realpath($file));
$file = $f->Size;
} else {
$file = trim(exec("for %F in (\"" . $file . "\") do @echo %~zF"));
}
} elseif (PHP_OS == 'Darwin') {
$file = trim(shell_exec("stat -f %z " . escapeshellarg($file)));
} elseif ((PHP_OS == 'Linux') || (PHP_OS == 'FreeBSD') || (PHP_OS == 'Unix') || (PHP_OS == 'SunOS')) {
$file = trim(shell_exec("stat -c%s " . escapeshellarg($file)));
} else {
$file = filesize($file);
}
if ($file < 1024) {
return $file . ' Byte';
} elseif ($file < 1048576) {
return round($file / 1024, 2) . ' KB';
} elseif ($file < 1073741824) {
return round($file / 1048576, 2) . ' MB';
} elseif ($file < 1099511627776) {
return round($file / 1073741824, 2) . ' GB';
} elseif ($file < 1125899906842624) {
return round($file / 1099511627776, 2) . ' TB';
} elseif ($file < 1152921504606846976) {
return round($file / 1125899906842624, 2) . ' PB';
} elseif ($file < 1180591620717411303424) {
return round($file / 1152921504606846976, 2) . ' EB';
} elseif ($file < 1208925819614629174706176) {
return round($file / 1180591620717411303424, 2) . ' ZB';
} else {
return round($file / 1208925819614629174706176, 2) . ' YB';
}
}
I'm am having a hard time finding people to help get where I need to be so any help anyone can give would be greatly appreciated.
I think what I am trying to do is use a php code to get mysql to get all the data for me from the server. Then I would like to use all the data in the database to paste back onto the site. That way the page isn't trying to load all the actual files and stuff, only when someone clicks the link to download it. I might not need to do it that way so if someone would like to talk 1 on 1 I would be more than happy doing it that way to try and explain myself better. Send me a message and we can chat live via facebook or something else.