Ошибка плагина download manager при загрузке файлов

No file selected

При загрузке файлов на блог с помощью плагина «WordPress Download Monitor» возникала ошибка. Почему-то писалось о не выделенном файле. Пыпытки разобраться в настройках плагина и в файле .htaccess, ни к чему не привели. Решение оказалось намного проще.

Решение:

Заходим в корень блога и ищем файл .

/wp-includes/functions.php

в нём примерно начиная с 2560 строки будет описание расширений файлов.

/**
 * Retrieve list of allowed mime types and file extensions.
 *
 * @since 2.8.6
 *
 * @return array Array of mime types keyed by the file extension regex corresponding to those types.
 */
function get_allowed_mime_types() {
	static $mimes = false;

	if ( !$mimes ) {
		// Accepted MIME types are set here as PCRE unless provided.
		$mimes = apply_filters( 'upload_mimes', array(
		'jpg|jpeg|jpe' => 'image/jpeg',
		'gif' => 'image/gif',
		'png' => 'image/png',
		'bmp' => 'image/bmp',
		'tif|tiff' => 'image/tiff',
		'ico' => 'image/x-icon',
		'asf|asx|wax|wmv|wmx' => 'video/asf',
		'avi' => 'video/avi',
		'divx' => 'video/divx',
		'flv' => 'video/x-flv',
		'mov|qt' => 'video/quicktime',
		'mpeg|mpg|mpe' => 'video/mpeg',
		'txt|asc|c|cc|h' => 'text/plain',
		'csv' => 'text/csv',
		'tsv' => 'text/tab-separated-values',
		'ics' => 'text/calendar',
		'rtx' => 'text/richtext',
		'css' => 'text/css',
		'htm|html' => 'text/html',
		'mp3|m4a|m4b' => 'audio/mpeg',
		'mp4|m4v' => 'video/mp4',
		'ra|ram' => 'audio/x-realaudio',
		'wav' => 'audio/wav',
		'ogg|oga' => 'audio/ogg',
		'ogv' => 'video/ogg',
		'mid|midi' => 'audio/midi',
		'wma' => 'audio/wma',
		'mka' => 'audio/x-matroska',
		'mkv' => 'video/x-matroska',
		'rtf' => 'application/rtf',
		'js' => 'application/javascript',
		'pdf' => 'application/pdf',
		'doc|docx' => 'application/msword',
		'pot|pps|ppt|pptx|ppam|pptm|sldm|ppsm|potm' => 'application/vnd.ms-powerpoint',
		'wri' => 'application/vnd.ms-write',
		'xla|xls|xlsx|xlt|xlw|xlam|xlsb|xlsm|xltm' => 'application/vnd.ms-excel',
		'mdb' => 'application/vnd.ms-access',
		'mpp' => 'application/vnd.ms-project',
		'docm|dotm' => 'application/vnd.ms-word',
		'pptx|sldx|ppsx|potx' => 'application/vnd.openxmlformats-officedocument.presentationml',
		'xlsx|xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml',
		'docx|dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml',
		'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote',
		'swf' => 'application/x-shockwave-flash',
		'class' => 'application/java',
		'tar' => 'application/x-tar',
		'zip' => 'application/zip',
		'gz|gzip' => 'application/x-gzip',
		'rar' => 'application/rar',
		'7z' => 'application/x-7z-compressed',
		'exe' => 'application/x-msdownload',
		// openoffice formats
		'odt' => 'application/vnd.oasis.opendocument.text',
		'odp' => 'application/vnd.oasis.opendocument.presentation',
		'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
		'odg' => 'application/vnd.oasis.opendocument.graphics',
		'odc' => 'application/vnd.oasis.opendocument.chart',
		'odb' => 'application/vnd.oasis.opendocument.database',
		'odf' => 'application/vnd.oasis.opendocument.formula',
		// wordperfect formats
		'wp|wpd' => 'application/wordperfect',
		// my
		'abr' => 'application/x-photoshop',
		'exe' => 'application/x-ms-dos-executable',
		'deb' => 'application/x-debian-package',
		'bat' => 'application/x-msdos-program',
		'sh' => 'text/plain',
		'rpm' => 'application/x-rpm',
		'msi' => 'application/x-msi',
		'reg' => 'application/octet-stream',
		'bin' => 'application/octet-stream',
		'ima' => 'application/octet-stream',
		'img' => 'application/octet-stream',
		) );
	}

	return $mimes;
}

Вот часть добавленная мной:

// my
'abr' => 'application/x-photoshop',
'exe' => 'application/x-ms-dos-executable',
'deb' => 'application/x-debian-package',
'bat' => 'application/x-msdos-program',
'sh' => 'text/plain',
'rpm' => 'application/x-rpm',
'msi' => 'application/x-msi',
'reg' => 'application/octet-stream',
'bin' => 'application/octet-stream',
'ima' => 'application/octet-stream',
'img' => 'application/octet-stream',
'torrent' => 'application/x-bittorrent',
'reg' => 'application/octet-stream',

Чтобы найти значение для расщирения файла идём на с айт

http://www.filesuffix.com

На рисунке показан пример для расширения «img»

Share

You may also like...

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *