Code Duplication    Length = 8-9 lines in 2 locations

addmedia.php 1 location

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

admin_media_upload.php 1 location

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