Code Duplication    Length = 11-11 lines in 2 locations

class/SwUploadHandler.php 1 location

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

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']) {