Code Duplication    Length = 11-11 lines in 2 locations

class/SwUploadHandler.php 1 location

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

class/UploadHandler.php 1 location

@@ 686-696 (lines=11) @@
683
            }
684
            $file_path   = $this->get_upload_path($file->name);
685
            $append_file = $content_range && is_file($file_path) && $file->size > $this->get_file_size($file_path);
686
            if ($uploaded_file && is_uploaded_file($uploaded_file)) {
687
                // multipart/formdata uploads (POST method uploads)
688
                if ($append_file) {
689
                    file_put_contents($file_path, fopen($uploaded_file, 'rb'), FILE_APPEND);
690
                } else {
691
                    move_uploaded_file($uploaded_file, $file_path);
692
                }
693
            } else {
694
                // Non-multipart uploads (PUT method support)
695
                file_put_contents($file_path, fopen('php://input', 'rb'), $append_file ? FILE_APPEND : 0);
696
            }
697
            $file_size = $this->get_file_size($file_path, $append_file);
698
            if ($file_size === $file->size) {
699
                if ($this->options['orient_image']) {