Code Duplication    Length = 8-9 lines in 2 locations

addmedia.php 1 location

@@ 183-190 (lines=8) @@
180
		}
181
		if (move_uploaded_file($_FILES['mediafile']['tmp_name'], $serverFileName)) {
182
			Log::addMediaLog('Media file ' . $serverFileName . ' uploaded');
183
		} else {
184
			FlashMessages::addMessage(
185
				I18N::translate('There was an error uploading your file.') .
186
				'<br>' .
187
				Functions::fileUploadErrorText($_FILES['mediafile']['error'])
188
			);
189
			break;
190
		}
191
192
		// Now copy the (optional) thumbnail
193
		if (!empty($_FILES['thumbnail']['name']) && preg_match('/^image\/(png|gif|jpeg)/', $_FILES['thumbnail']['type'], $match)) {

admin_media_upload.php 1 location

@@ 143-151 (lines=9) @@
140
				if (move_uploaded_file($_FILES['mediafile' . $i]['tmp_name'], $serverFileName)) {
141
					FlashMessages::addMessage(I18N::translate('The file %s has been uploaded.', Html::filename($serverFileName)));
142
					Log::addMediaLog('Media file ' . $serverFileName . ' uploaded');
143
				} else {
144
					FlashMessages::addMessage(
145
						I18N::translate('There was an error uploading your file.') .
146
						'<br>' .
147
						Functions::fileUploadErrorText($_FILES['mediafile' . $i]['error'])
148
					);
149
					$filename = '';
150
					break;
151
				}
152
153
				// Now copy the (optional thumbnail)
154
				if (!empty($_FILES['thumbnail' . $i]['name']) && preg_match('/^image\/(png|gif|jpeg)/', $_FILES['thumbnail' . $i]['type'], $match)) {