How to upload APK file in WordPress 2022?
In this post, you will learn how to upload APK file in WordPress without using any plugin or FTP client. This method also works for additional file types such as SVG, ZIP to be uploaded in WordPress.
For security purposes, WordPress only allows a limited set of file types to be uploaded in WordPress media.
Those certain file types are mainly associated with documents, images, audio, and video.
Images | Documents | Audio | Video |
---|---|---|---|
.jpg | .pdf (Portable Document Format; Adobe Acrobat) | .mp3 | .mp4, .m4v (MPEG-4) |
.jpeg | .doc, .docx (Microsoft Word Document) | .m4a | .mov (QuickTime) |
.png | .ppt, .pptx, .pps, .ppsx (Microsoft PowerPoint Presentation) | .ogg | .wmv (Windows Media Video) |
.gif | .odt (OpenDocument Text Document) | .wav | .avi |
.ico | .xls, .xlsx (Microsoft Excel Document) | .mpg | |
.psd (Adobe Photoshop Document) | .ogv (Ogg) | ||
.3gp (3GPP) | |||
.3g2 (3GPP2) |
When you try to upload a file having an extension other than these, you will get an error as below.
Sorry, this file type is not permitted for security reasons.
However, you can exceptions to the security and allow whichever file type you want to be uploaded to your WordPress site.
But now that you are here, you don’t need to worry as you will be able to fix this is a minute.
Below is a summary of the steps you need to follow to allow APK files to be uploaded in WordPress.
Step 1
Login to your WordPress Dashboard.
Step 2
Go to Appearance >> Editor
Step 3
From the theme directory, locate the functions.php file. You will be adding the code to create an exception here.
It is important to know that functions.php is the file behind the characteristics and functionality of your website.
Go ahead and copy-paste the below code snippet to the bottom of the functions.php file
add_filter('upload_mimes', 'allow_custom_mimes');
function allow_custom_mimes ( $existing_mimes=array() ) {
// ' with mime type 'application/vnd.android.package-archive'
$existing_mimes['apk'] = 'application/vnd.android.package-archive';
return $existing_mimes;
}
Step 4
Click on Update File, and that’s it.
You are done.
Now go ahead and try to upload a .apk file to WordPress, and you will be able to upload it without any issue.
Conclusion: How to upload APK file in WordPress 2022
I hope you liked this post and found it helpful.
Let us know in the comments if you face any issues.
How to Change the Howdy Text in WordPress?
Top Rank Tracker Tools to Use in 2022
How to Automatically Add Content After Post in WordPress
Bonus : Additional File Types (Updated 2022)
For file types other than APK, you just need to replace
[code type=”javascript”]$existing_mimes[‘apk’] = ‘application/vnd.android.package-archive
‘;
with the respective line of code as per the file type.
For example it will be done this way for PDF
[code type=”javascript”]$existing_mimes[‘pdf’] =’application/pdf
‘;
Here is the list that will help you do it for other file types
How to upload pdf file in wordpress ?
Adobe Portable Document Format | application/pdf |
How to upload svg file in wordpress ?
Scalable Vector Graphics (SVG) | image/svg+xml | .svg |
How to upload html file in wordpress ?
HyperText Markup Language (HTML) | text/html | .html |
How to upload exe file in wordpress ?
Microsoft Application | application/x-msdownload | .exe |
How to upload xml file in wordpress ?
XML – Extensible Markup Language | application/xml | .xml |
How to upload JSON file in wordpress ?
JavaScript Object Notation (JSON) | application/json |
How to upload zip file in wordpress ?
Zip Archive | application/zip | .zip |
How to upload PHP file in WordPress?
Well, this is tricky because WordPress itself is written in PHP.
The best way is to create a WordPress Page and set its template (from the right-hand side of the edit page screen in WordPress to the PHP file you want to upload.
How to upload swf file in wordpress ?
Adobe Flash | application/x-shockwave-flash | .swf |
How to upload css file in wordpress ?
Cascading Style Sheets (CSS) | text/css | .css |
How to upload csv file in wordpress ?
Comma-Seperated Values | text/csv | .csv |
How to upload js file in wordpress ?
JavaScript | application/javascript | .js |
How to upload rar file in wordpress ?
RAR Archive | application/x-rar-compressed | .rar |
How to upload excel file in wordpress ?
Microsoft Excel | application/vnd.ms-excel | .xls |
Dinesh Kumar says
Even after pasting the above code at the bottom of functions.php still I am not abl to upload APK file.
admin says
Are you getting the same error as before?
Sumeet says
ok it works but after restarting the server on which wordpress is installed !
admin says
Glad it worked.
Sumeet says
same issue i am facing …
The Error :
“app-release.apk” has failed to upload.
Sorry, this file type is not permitted for security reasons.
Peter says
Good post but the Funcion.php is not writeable.
admin says
It might be because of your hosts settings, you can ask them to change it.
Waqas says
i am trying to upload the apk file after modifying the code in function.php. Now i am not facing this error immediately but after uploading the complete file, WordPress is giving me this error: “Sorry, this file type is not permitted for security reasons.” and i am not able to get url link for file downloading
android says
Tnx for you good post for android.you fix my issue.
[email protected] says
Thanks, solved my APK problem.
Radesh says
I can upload apk after pasting this code but where is apk now, how to add it in wordpress page for users.
hamza says
Thanks, its working
Efutura says
Does this also work for ipa files for iOS apps?
CBONE says
Thank you, it worked
Icepax says
Thanks this works
Melba Brewer says
You are welcome 🙂
Icepax Knight says
Thanks, this is the only solution I found that works!
Adekiya says
What about for vcf files?
Sarfraj Ahamed says
Great!
NAON says
Oh thank you so much
This is work, and solved all of my problem with apk file