mirror of
https://github.com/prasathmani/tinyfilemanager
synced 2024-06-27 18:00:23 +02:00
use stream_copy_to_stream
it's simpler, and should be faster. For example, stream_copy_to_stream can use sendfile ( https://man7.org/linux/man-pages/man2/sendfile.2.html ) on operating systems supporting it, which is faster and use less RAM than fread()+fwrite() (because it avoids copying data to/from userland, doing the copy entirely in-kernel~)
This commit is contained in:
parent
6a6eb8abec
commit
f918b954b8
|
@ -969,7 +969,7 @@ if (!empty($_FILES) && !FM_READONLY) {
|
||||||
if ($out) {
|
if ($out) {
|
||||||
$in = @fopen($tmp_name, "rb");
|
$in = @fopen($tmp_name, "rb");
|
||||||
if ($in) {
|
if ($in) {
|
||||||
while ($buff = fread($in, 4096)) { fwrite($out, $buff); }
|
stream_copy_to_stream($in, $out);
|
||||||
$response = array (
|
$response = array (
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'info' => "file upload successful"
|
'info' => "file upload successful"
|
||||||
|
|
Loading…
Reference in a new issue