simogeo / Filemanager

An open-source file manager released under MIT license. Up-to-date for PHP connector. This package is DEPRECATED. Now, please use RichFileManager available at : https://github.com/servocoder/RichFilemanager.
938 stars 350 forks source link

download not working #519

Closed doziteh closed 7 years ago

doziteh commented 7 years ago

In php connector LocalFilemanager.php line 852 actionDownload() method ... $chunk_size = 16 1024 1024; // read file by chunks to handle large files

        if ($chunk_size && $file_size > $chunk_size) {
            $handle = fopen($target_fullpath, 'rb');
            while (!feof($handle)) {
                echo fread($handle, $chunk_size);
                @ob_flush();
                @flush();
            }
            fclose($handle);
        } 

No else? Pretty sure this is not correct... I added
else { $handle = fopen($target_fullpath, 'rb'); echo fread($handle, $file_size); @ob_flush(); @flush();

            fclose($handle);
        }

and now I can download files...

psolom commented 7 years ago

Hi, "else" makes sense, but due to $chunk_size = 16 * 1024 * 1024; line is hardcoded it should always go to "if". What was your problem? Won't you be able to download file with the initial code? Any error? I would like to reproduce your problem while download process.

psolom commented 7 years ago

Btw, do you use RichFilemanager from my repo or Filemanager from the current repo? I may suppose the first one. If so your should ask here. Please, duplicate your issue at the correct repo.