{"id":361,"date":"2014-04-29T17:36:14","date_gmt":"2014-04-29T17:36:14","guid":{"rendered":"http:\/\/pixert.com\/blog\/?p=361"},"modified":"2014-06-10T15:44:52","modified_gmt":"2014-06-10T15:44:52","slug":"allow-wordpress-upload-flash-swf-files","status":"publish","type":"post","link":"https:\/\/pixert.com\/blog\/allow-wordpress-upload-flash-swf-files\/","title":{"rendered":"How to allow WordPress to upload Flash SWF files"},"content":{"rendered":"<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>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<a title=\"Uploading Files to WordPress\" href=\"http:\/\/codex.wordpress.org\/Uploading_Files\"> we try to upload Flash SWF\u00a0files in WordPress<\/a><!--more--><\/p>\n<p><a title=\"WordPress Network\/Multisite: Sorry, this file type is not permitted for security reasons\" href=\"http:\/\/pixert.com\/blog\/wordpress-networkmultisite-sorry-file-type-permitted-security-reasons\/\">Previously, we wrote a post to lifted this restriction<\/a>\u00a0in WordPress that allow users to upload file types, however this method don&#8217;t work when we added SWF to Upload file types settings in <strong>WordPress Multisite\/Network<\/strong>\u00a0without telling WordPress to allow Flash SWF file type first<\/p>\n<p>Add following code to theme functions.php file to allow Flash SWF uploaded to the site<\/p>\n<pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">\/* allow upload flash *\/\r\nadd_filter('upload_mimes', 'pixert_upload_swf');\r\nfunction pixert_upload_swf($existing_mimes){\r\n$existing_mimes&#x5B;'swf'] = 'text\/swf'; \/\/allow swf files\r\nreturn $existing_mimes;\r\n}\r\n\/* allow upload flash *\/<\/pre>\n<p>or<\/p>\n<pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">function pixert_allow_swf($mimes) {\r\n\tif ( function_exists( 'current_user_can' ) )\r\n\t\t$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );\r\n\tif ( !empty( $unfiltered ) ) {\r\n\t\t$mimes&#x5B;'swf'] = 'application\/x-shockwave-flash';\r\n\t}\r\n\treturn $mimes;\r\n}\r\nadd_filter('upload_mimes','pixert_allow_swf');<\/pre>\n<p>After that, we could add SWF to Upload file types settings in WordPress Multisite\/Network<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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<\/p>\n","protected":false},"author":1,"featured_media":373,"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":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[54,5],"tags":[55,6,7],"class_list":["post-361","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code-snippet","category-wordpress","tag-code-snippet-2","tag-wordpress-2","tag-wp"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/04\/filetypeerror.jpg?fit=645%2C117&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1pvi1-5P","jetpack-related-posts":[{"id":360,"url":"https:\/\/pixert.com\/blog\/wordpress-file-type-permitted-security-reasons\/","url_meta":{"origin":361,"position":0},"title":"WordPress file type is not permitted for security reasons","author":"Pixel Insert \/ Pixert","date":"April 17, 2014","format":false,"excerpt":"This article explain little bit about uploading files to WordPress and its error when WordPress don't allow some file types.\u00a0WordPress by default allow users to upload\u00a0following file types Images .jpg .jpeg .png .gif Documents .pdf (Portable Document Format; Adobe Acrobat) .doc, .docx (Microsoft Word Document) .ppt, .pptx, .pps, .ppsx (Microsoft\u2026","rel":"","context":"In &quot;WordPress&quot;","block_context":{"text":"WordPress","link":"https:\/\/pixert.com\/blog\/category\/wordpress\/"},"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":227,"url":"https:\/\/pixert.com\/blog\/mp4-video-cannot-play-on-ipad-ipod-iphone-using-jw-player-shortocode\/","url_meta":{"origin":361,"position":1},"title":"MP4 video cannot play on iPad\/iPod\/iPhone using JW Player shortcode","author":"Pixel Insert \/ Pixert","date":"May 14, 2012","format":false,"excerpt":"It seems that this is a bug on JW Player for WordPress plugin We added JW Player or WordPress plugin shortcode with a mp4 video in it, the video plays on Macbooks and PCs, but it shows blank on iPad or iPod or iPhone. Although HTML5 as default mode, it\u2026","rel":"","context":"In &quot;iOS&quot;","block_context":{"text":"iOS","link":"https:\/\/pixert.com\/blog\/category\/ios\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":127,"url":"https:\/\/pixert.com\/blog\/wordpress-sorry-this-file-type-is-not-permitted-for-security-reasons\/","url_meta":{"origin":361,"position":2},"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":361,"position":3},"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":179,"url":"https:\/\/pixert.com\/blog\/how-to-change-the-bullet-size-and-color-css\/","url_meta":{"origin":361,"position":4},"title":"How to change the bullet size and color with CSS","author":"Pixel Insert \/ Pixert","date":"December 20, 2011","format":false,"excerpt":"The following code snippet help you change the bullet size and color of your unordered lists. We are using simple CSS code to do that 1. Create your bullet list image via Adobe Photoshop or you can use another image editor to do that (e.g Pixelmator). Save the image as\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\/12\/csslogo.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":134,"url":"https:\/\/pixert.com\/blog\/install-favicon-into-a-wordpress-website\/","url_meta":{"origin":361,"position":5},"title":"Install Favicon into a WordPress website","author":"Pixel Insert \/ Pixert","date":"August 22, 2011","format":false,"excerpt":"1. Upload favicon.ico to the theme directory, e.g wp-content\/themes\/twentyeleven 2. Open file header.php, add the following code between <head> and <\/head> [php]<link rel=\"shortcut icon\" href=\"<?php bloginfo('stylesheet_directory'); ?>\/favicon.ico\" \/>[\/php]","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":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/361","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=361"}],"version-history":[{"count":0,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/361\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media\/373"}],"wp:attachment":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media?parent=361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/categories?post=361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/tags?post=361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}