{"id":1960691,"date":"2024-07-19T01:22:54","date_gmt":"2024-07-19T05:22:54","guid":{"rendered":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/?p=1960691"},"modified":"2025-06-29T12:25:02","modified_gmt":"2025-06-29T16:25:02","slug":"resolved-sorry-you-are-not-allowed-to-upload-this-file-type","status":"publish","type":"post","link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/resolved-sorry-you-are-not-allowed-to-upload-this-file-type\/","title":{"rendered":"Resolved: Sorry, you are not allowed to upload this file type"},"content":{"rendered":"\n<p>The message \u201cSorry, you are not allowed to upload this file type\u201d appears when you try to upload a file with an extension that WordPress, by default, may not allow.<\/p>\n\n\n\n<p class=\"has-theme-palette-8-background-color has-background\">For a list of the file extensions allowed by WordPress, see: <a href=\"https:\/\/codex.wordpress.org\/Uploading_Files\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress Codex: Uploading Files<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-editing-the-wp-config-php-file\">Editing the wp-config.php File<\/h2>\n\n\n\n<p>To allow file extensions outside the defaults, you\u2019ll want to edit the <u><code>wp-config.php<\/code><\/u> file for your WordPress site. This is usually found in the <u><code>public_html<\/code><\/u> folder.<\/p>\n\n\n\n<p>Next, add the following above the line \u2018<em>That\u2019s all, stop editing! Happy publishing.<\/em>\u2018<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndefine(&#039;ALLOW_UNFILTERED_UPLOADS&#039;, true);\n<\/pre><\/div>\n\n\n<p>After saving the file, you should be able to upload the desired file.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-security-considerations\">Security Considerations<\/h4>\n\n\n\n<p>For security reasons, it is recommended to remove the <code>ALLOW_UNFILTERED_UPLOADS<\/code> line from the <code>wp-config.php<\/code> file after you have uploaded the necessary files. If you need to upload more files in the future, you can add the line again.<\/p>\n\n\n\n<p>Additionally, it is important to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Limit Allowed File Types<\/strong>: Only allow the upload of essential file types. Set a maximum file size for uploads to prevent excessively large files.<\/li>\n\n\n\n<li><strong>Install a WordPress Security Plugin<\/strong>: Use a WordPress security plugin to monitor your site for vulnerabilities and regularly scan for any malicious code.<\/li>\n\n\n\n<li><strong>Restrict File Uploads for Non-Registered Users<\/strong>: Limit file uploads to only the necessary file types for non-registered users, using a file upload form to manage this.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-allowing-specific-file-types\">Allowing Specific File Types<\/h4>\n\n\n\n<p>Alternatively, you can use a code snippet to exclusively allow a specific file type, such as SVG files, without enabling unfiltered uploads:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/**\n * Function to change the allowed mime types\n *\n * @param  array $mimes Allowed mime types.\n * @return array Updated mime types list.\n *\/\nfunction my_custom_mime_types($mimes) {\n    \/\/ Add new allowed mime types.\n    $mimes&#x5B;&#039;svg&#039;] = &#039;image\/svg+xml&#039;;\n    $mimes&#x5B;&#039;svgz&#039;] = &#039;image\/svg+xml&#039;;\n\n    return $mimes;\n}\n\nadd_filter(&#039;upload_mimes&#039;, &#039;my_custom_mime_types&#039;);\n<\/pre><\/div>\n\n\n<p>This approach allows you to selectively enable specific file types without compromising the overall security of your WordPress site.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-the-file-upload-types-by-wpforms-plugin\">The File Upload Types by WPForms Plugin<\/h2>\n\n\n\n<p>The <a href=\"https:\/\/wordpress.org\/plugins\/file-upload-types\/\">File Upload Types by WPForms<\/a> plugin is an alternative solution to the manual methods mentioned above. This plugin allows you to easily add support for additional file types in WordPress without modifying the\u00a0wp-config.php\u00a0file. The plugin provides a user-friendly interface in the WordPress admin dashboard, where you can specify the file types you want to allow (including custom file types).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"579\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2024\/07\/image-103-1024x579.png\" alt=\"\" class=\"wp-image-1965799\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2024\/07\/image-103-1024x579.png 1024w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2024\/07\/image-103-300x170.png 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2024\/07\/image-103-768x434.png 768w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2024\/07\/image-103-1536x868.png 1536w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2024\/07\/image-103.png 1571w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Using the File Upload Types by WPForms plugin can be a convenient way to manage file type restrictions in WordPress, especially if you need to allow multiple file types or frequently change the allowed file types. However, it&#8217;s still important to consider the security implications carefully and only allow the necessary file types for your website.<\/p>\n\n\n\n<p>By following these guidelines, you can effectively address the &#8220;Sorry, this file type is not permitted for security reasons&#8221; error in WordPress while maintaining a secure and well-managed website.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The message \u201cSorry, you are not allowed to upload this file type\u201d appears when you try to upload a file with an extension that WordPress, by default, may not allow. For a list of the file extensions allowed by WordPress, see: WordPress Codex: Uploading Files Editing the wp-config.php File To allow file extensions outside the&#8230;<\/p>\n","protected":false},"author":19,"featured_media":1955565,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[93],"tags":[45],"stellar-product-taxonomy":[154],"class_list":["post-1960691","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-errors","tag-importing","stellar-product-taxonomy-event-aggregator"],"acf":[],"taxonomy_info":{"category":[{"value":93,"label":"Troubleshooting"}],"post_tag":[{"value":45,"label":"Importing"}],"stellar-product-taxonomy":[{"value":154,"label":"Event Aggregator"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Erica Eide","author_link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/author\/ericaeide\/"},"comment_info":0,"category_info":[{"term_id":93,"name":"Troubleshooting","slug":"errors","term_group":0,"term_taxonomy_id":93,"taxonomy":"category","description":"","parent":0,"count":67,"filter":"raw","term_order":"0","cat_ID":93,"category_count":67,"category_description":"","cat_name":"Troubleshooting","category_nicename":"errors","category_parent":0}],"tag_info":[{"term_id":45,"name":"Importing","slug":"importing","term_group":0,"term_taxonomy_id":45,"taxonomy":"post_tag","description":"","parent":0,"count":35,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1960691","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1960691"}],"version-history":[{"count":4,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1960691\/revisions"}],"predecessor-version":[{"id":1965800,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1960691\/revisions\/1965800"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1960691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1960691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1960691"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1960691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}