Sometimes when you try lớn upload a tệp tin to WordPress, you’ll see this error: “Sorry, this file type is not permitted for security reasons.” This usually occurs because the file’s MIME type (also called “Media type”) is restricted from upload due to default WordPress settings.

Bạn đang xem:

Luckily, there are several ways to authorize additional file types for upload.

Table of Contents:

1. MIME types explained2. Authorize uploads for additional MIME types using a plugin3. Authorize uploads for additional MIME types via functions.php4. Allow unfiltered uploads via wp-config.php5. Configure multisite upload settings

MIME types explained

MIME stands for Multipurpose internet Mail Extensions. MIME types are used by browsers và other mạng internet devices lớn determine the type of content associated with a page.

For instance, if you have a .png file & a .jpeg tệp tin on a page, the browser would know by their MIME types (not their tệp tin extension) khổng lồ treat both files as images, rather than videos or other file types.

By default, WordPress stores a danh sách of registered MIME types in wp-includes/functions.php. However, not all MIME types recognized are allowed to be uploaded in the WordPress admin dashboard.

Xem thêm: Làm Sao Để Nhận Tiền Từ Youtube, Cách Nhận Tiền Trên Youtube Đơn Giản Và Hiệu Quả

File types supported by default

Documents.pdf (Portable Document Format; Adobe Acrobat).doc, .docx (Microsoft Word Document).ppt, .pptx, .pps, .ppsx (Microsoft PowerPoint Presentation).odt (OpenDocument Text Document).xls, .xlsx (Microsoft Excel Document).psd (Adobe Photoshop Document)
Video.mp4, .m4v (MPEG-4).mov (QuickTime).wmv (Windows truyền thông media Video).avi.mpg.ogv (Ogg).3gp (3GPP).3g2 (3GPP2)

To allow uploading of tệp tin types not listed above, there are a few ways khổng lồ get around the restrictions.

Authorize uploads for additional MIME types using a plugin

We recommend WP Extra file Types. Setup is really simple, just click the tệp tin types you want khổng lồ allow and save your changes.


Other plugin options include:

Authorize uploads for additional MIME types via functions.php

If you’re code-savvy, you can địa chỉ cửa hàng the requirements to the active theme’s functions.php file. The example below can be modified for the tệp tin types you want lớn allow:

function my_theme_custom_upload_mimes( $existing_mimes ) // showroom webm lớn the menu of mime types. $existing_mimes<"webm"> = "video/webm";// Return the array back lớn the function with our added mime type.return $existing_mimes;add_filter( "mime_types", "my_theme_custom_upload_mimes" );

Allow unfiltered uploads via wp-config.php

All uploads can be authorized with the addition of the following line khổng lồ the site’s wp-config.php file:

define("ALLOW_UNFILTERED_UPLOADS", true);It’s important to note that this allows all tệp tin types khổng lồ be uploaded by administrator-level users. It’s best practice to showroom file types as needed.

NoteSince Flywheel restricts editing the WordPress core, including wp-config.php, please reach out to our tư vấn team lớn perform this change.

Configure multisite upload settings

If you are developing a multisite, you can edit MIME types directly from the multisite settings, no plugins or coding required!

From the WordPress admin area, navigate to Network Admin > Settings > Network SettingsScroll down to Upload Settings and add or remove file types from the Upload file types field.

Still need help?

If you have additional questions about MIME types or uploading files, our Happiness Engineers would be glad khổng lồ help!