frankagrubisic / clients-oriented-ftp

Automatically exported from code.google.com/p/clients-oriented-ftp
0 stars 0 forks source link

File Size #231

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Upload file via FTP to *files* folder; visit projectsend>>Files>>Find 
Orpaned Files and find file, assign to client; system sends email message
2. File Uploaded 59 MB but when seen from client side, file is zero bytes!
3. File download cannot indicate file size and I keep getting complaints

What is the expected output? What do you see instead?
File size must be indicated as 59MB or whatever is the size.

What version of the product are you using? On what operating system?
r375

Please provide any additional information below.

Original issue reported on code.google.com by sanjayrath on 9 Mar 2013 at 2:53

Attachments:

GoogleCodeExporter commented 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

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
r412 file download 0kb please solved this problem

Original comment by bdwebc...@gmail.com on 17 Sep 2013 at 8:34