Code Duplication    Length = 11-11 lines in 2 locations

class/UploadHandler.php 1 location

@@ 653-663 (lines=11) @@
650
            }
651
            $file_path   = $this->get_upload_path($file->name);
652
            $append_file = $content_range && is_file($file_path) && $file->size > $this->get_file_size($file_path);
653
            if ($uploaded_file && is_uploaded_file($uploaded_file)) {
654
                // multipart/formdata uploads (POST method uploads)
655
                if ($append_file) {
656
                    file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND);
657
                } else {
658
                    move_uploaded_file($uploaded_file, $file_path);
659
                }
660
            } else {
661
                // Non-multipart uploads (PUT method support)
662
                file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
663
            }
664
            $file_size = $this->get_file_size($file_path, $append_file);
665
            if ($file_size === $file->size) {
666
                if ($this->options['orient_image']) {

class/SwUploadHandler.php 1 location

@@ 155-165 (lines=11) @@
152
            $file_path   = $this->upload_dir . $file->name;
153
            $append_file = is_file($file_path) && $file->size > filesize($file_path);
154
            clearstatcache();
155
            if ($uploaded_file && is_uploaded_file($uploaded_file)) {
156
                // multipart/formdata uploads (POST method uploads)
157
                if ($append_file) {
158
                    file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND);
159
                } else {
160
                    move_uploaded_file($uploaded_file, $file_path);
161
                }
162
            } else {
163
                // Non-multipart uploads (PUT method support)
164
                file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
165
            }
166
            $file_size = filesize($file_path);
167
            if ($file_size === $file->size) {
168
                $file->url       = $this->upload_url . rawurlencode($file->name);