{"id":360,"date":"2014-04-17T11:06:21","date_gmt":"2014-04-17T11:06:21","guid":{"rendered":"http:\/\/pixert.com\/blog\/?p=360"},"modified":"2023-03-20T01:31:54","modified_gmt":"2023-03-20T01:31:54","slug":"wordpress-file-type-permitted-security-reasons","status":"publish","type":"post","link":"https:\/\/pixert.com\/blog\/wordpress-file-type-permitted-security-reasons\/","title":{"rendered":"WordPress file type is not permitted for security reasons"},"content":{"rendered":"<p>This article explain little bit about uploading files to WordPress and its error when WordPress don&#8217;t allow some file types.\u00a0<!--more-->WordPress by default allow users to upload\u00a0following file types<\/p>\n<p><strong>Images<\/strong><\/p>\n<p>.jpg<br \/>\n.jpeg<br \/>\n.png<br \/>\n.gif<br \/>\n<strong>Documents<\/strong><\/p>\n<p>.pdf (Portable Document Format; Adobe Acrobat)<br \/>\n.doc, .docx (Microsoft Word Document)<br \/>\n.ppt, .pptx, .pps, .ppsx (Microsoft PowerPoint Presentation)<br \/>\n.odt (OpenDocument Text Document)<br \/>\n.xls, .xlsx (Microsoft Excel Document)<br \/>\n<strong>Audio<\/strong><\/p>\n<p>.mp3<br \/>\n.m4a<br \/>\n.ogg<br \/>\n.wav<br \/>\n<strong>Video<\/strong><\/p>\n<p>.mp4, .m4v (MPEG-4)<br \/>\n.mov (QuickTime)<br \/>\n.wmv (Windows Media Video)<br \/>\n.avi<br \/>\n.mpg<br \/>\n.ogv (Ogg)<br \/>\n.3gp (3GPP)<br \/>\n.3g2 (3GPP2)<!--more--><\/p>\n<p><a href=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"373\" data-permalink=\"https:\/\/pixert.com\/blog\/allow-wordpress-upload-flash-swf-files\/filetypeerror\/\" data-orig-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?fit=645%2C117&amp;ssl=1\" data-orig-size=\"645,117\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"filetypeerror\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?fit=300%2C54&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?fit=645%2C117&amp;ssl=1\" class=\"aligncenter size-full wp-image-373\" src=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?resize=645%2C117\" alt=\"filetypeerror\" width=\"645\" height=\"117\" srcset=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?w=645&amp;ssl=1 645w, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?resize=300%2C54&amp;ssl=1 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/a><\/p>\n<p>WordPress will show security warning like this, &#8220;Sorry, this file type is not permitted for security reasons.\u201d when we try to upload other file formats. This security warning also show when some web hosts are not permitted\u00a0above file formats to be uploaded<\/p>\n<p>The easiest way to override this restriction is by adding following to wp-config.php, this constant all all file types to be uploaded to WordPress<\/p>\n<pre><pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">define('ALLOW_UNFILTERED_UPLOADS', true);<\/pre>\n<p>You could use following function to allow specific file types<\/p>\n<pre><pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">\nadd_filter('upload_mimes', 'pixert_upload_types');\nfunction pixert_upload_types($existing_mimes=array()){\n$existing_mimes&#x5B;'flv'] = 'video\/x-flv';\n$existing_mimes&#x5B;'mid'] = 'audio\/midi';\nreturn $existing_mimes;\n}\n<\/pre>\n<p>If you have set file types you could add new file types to Upload Settings in WordPress Multisite\/Network, this setting allow sub-domain to upload new file types<\/p>\n<blockquote><p>Go to WP-Admin &gt; My Sites &gt; Network Admin &gt; Settings &gt; Upload Settings, add mp4 to Upload file types (jpg jpeg png gif mp3 mov avi wmv midi mid pdf mp4 ) (32MB)<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>This article explain little bit about uploading files to WordPress and its error when WordPress don&#8217;t allow some file types.\u00a0<\/p>\n","protected":false},"author":1,"featured_media":25,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[6,7,44],"class_list":["post-360","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-wordpress-2","tag-wp","tag-wp-admin"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo.png?fit=498%2C113&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1pvi1-5O","jetpack-related-posts":[{"id":361,"url":"https:\/\/pixert.com\/blog\/allow-wordpress-upload-flash-swf-files\/","url_meta":{"origin":360,"position":0},"title":"How to allow WordPress to upload Flash SWF files","author":"Pixel Insert \/ Pixert","date":"April 29, 2014","format":false,"excerpt":"Some banner ads still use Flash SWF\u00a0format, unfortunately Flash SWF\u00a0is one of few format that has not been permitted in WordPress for security reason. WordPress generate error like this\u201cSorry, this file type is not permitted for security reasons.\u201c when we try to upload Flash SWF\u00a0files in WordPress Previously, we wrote\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"filetypeerror","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?resize=525%2C300 1.5x"},"classes":[]},{"id":127,"url":"https:\/\/pixert.com\/blog\/wordpress-sorry-this-file-type-is-not-permitted-for-security-reasons\/","url_meta":{"origin":360,"position":1},"title":"WordPress: Sorry, this file type is not permitted for security reasons.","author":"Pixel Insert \/ Pixert","date":"July 22, 2011","format":false,"excerpt":"Add the following code snippet to functions.php. Change 'filetype' to the file type that is not permitted for security reasons [php] add_filter('upload_mimes', 'custom_upload_mimes'); function custom_upload_mimes ( $existing_mimes=array() ) { \/\/ add the file extension to the array $existing_mimes['filetype'] = 'mime\/type'; \/\/ call the modified list of extensions return $existing_mimes; }\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":78,"url":"https:\/\/pixert.com\/blog\/limiting-access-to-admin-folder-htaccess\/","url_meta":{"origin":360,"position":2},"title":"Limiting Access to Admin folder via .htaccess","author":"Pixel Insert \/ Pixert","date":"March 31, 2011","format":false,"excerpt":"Some CMS have admin folder. It's an important folder because it has all the files that deal with administration. If the security of the files in it is compromised, bad things can happen. One effective option to reducing the risk of a security breach on the Admin folder is by\u2026","rel":"","context":"In &quot;Web Apps&quot;","block_context":{"text":"Web Apps","link":"https:\/\/pixert.com\/blog\/category\/web-apps\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/lock-288x300.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":358,"url":"https:\/\/pixert.com\/blog\/increase-file-upload-size-wordpress\/","url_meta":{"origin":360,"position":3},"title":"Increase File Upload Size WordPress","author":"Pixel Insert \/ Pixert","date":"April 17, 2014","format":false,"excerpt":"We see this error when we upload a file that bigger\u00a0than upload limit size , the error look like this \"exceeds the maximum upload size for this site\" The web hosting company may set \u00a0limit to file upload size, fortunately we could workaround this problem and increase file upload size\u2026","rel":"","context":"In &quot;WordPress&quot;","block_context":{"text":"WordPress","link":"https:\/\/pixert.com\/blog\/category\/wordpress\/"},"img":{"alt_text":"fileuploadsize","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/fileuploadsize.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/fileuploadsize.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/fileuploadsize.jpg?resize=525%2C300 1.5x"},"classes":[]},{"id":183,"url":"https:\/\/pixert.com\/blog\/basic-robots-txt-for-wordpress\/","url_meta":{"origin":360,"position":4},"title":"Basic robots.txt for WordPress","author":"Pixel Insert \/ Pixert","date":"January 6, 2012","format":false,"excerpt":"1. Never allow indexing of the cgi-bin [bash] User-agent: * Disallow: \/cgi-bin [\/bash] 2. Never allow indexing WordPress folders [bash] Disallow: \/wp-admin Disallow: \/wp-includes Disallow: \/wp-content\/plugins Disallow: \/wp-content\/cache Disallow: \/wp-content\/themes [\/bash] If you want to allow the \u00a0wp-content\/uploads folder [bash] Allow: \/wp-content\/uploads [\/bash] 3. Block feeds, this will make the\u2026","rel":"","context":"In &quot;WordPress&quot;","block_context":{"text":"WordPress","link":"https:\/\/pixert.com\/blog\/category\/wordpress\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":86,"url":"https:\/\/pixert.com\/blog\/protect-htaccess-file\/","url_meta":{"origin":360,"position":5},"title":"Protect .htaccess file","author":"Pixel Insert \/ Pixert","date":"April 5, 2011","format":false,"excerpt":"When avisitor tries to obtain access to .htaccess file, server automatically generates a 403 forbidden error. However, we can apply an extra layer of security to .htaccess Add the following [text] # Protect the htaccess file <Files .htaccess> Order Allow,Deny Deny from all <\/Files> [\/text] Note: htaccess file permissions is\u2026","rel":"","context":"In &quot;CentOS&quot;","block_context":{"text":"CentOS","link":"https:\/\/pixert.com\/blog\/category\/centos\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/lock-150x150.jpg?resize=350%2C200","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/comments?post=360"}],"version-history":[{"count":1,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/360\/revisions"}],"predecessor-version":[{"id":633,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/360\/revisions\/633"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media\/25"}],"wp:attachment":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media?parent=360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/categories?post=360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/tags?post=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}